Skip to content

Instantly share code, notes, and snippets.

@sortofsleepy
Created June 20, 2012 15:10
Show Gist options
  • Save sortofsleepy/2960388 to your computer and use it in GitHub Desktop.
Save sortofsleepy/2960388 to your computer and use it in GitHub Desktop.
varying vec3 vNormal;
varying vec2 vUv;
uniform vec3 color;
uniform sampler2D texture;
void main() {
vec3 light = vec3( 0.5, 0.2, 1.0 );
light = normalize( light );
float dProd = dot( vNormal, light ) * 0.5 + 0.5;
vec4 tcolor = texture2D( texture, vUv );
vec4 gray = vec4( vec3( tcolor.r * 0.3 + tcolor.g * 0.59 + tcolor.b * 0.11 ), 1.0 );
gl_FragColor = gray * vec4( vec3( dProd ) * vec3( color ), 1.0 );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment