Skip to content

Instantly share code, notes, and snippets.

@DragoonX6 DragoonX6/lambertian.frag Secret
Created Apr 13, 2019

Embed
What would you like to do?
Easy lambertian shading
#version 100
precision mediump float;
varying vec3 normal;
varying vec2 texCoord;
uniform sampler2D texture;
const vec3 light = vec3(0.21821789023, 0.43643578047, 0.87287156094);
void main()
{
float costheta = dot(normal, light);
vec3 col = max(costheta, 0.0) * texture2D(texture, texCoord).rgb;
gl_FragColor = vec4(col, 1.0);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.