Skip to content

Instantly share code, notes, and snippets.

@markgajdosik
Created May 22, 2014 14:31
Show Gist options
  • Save markgajdosik/43626464432b843f747f to your computer and use it in GitHub Desktop.
Save markgajdosik/43626464432b843f747f to your computer and use it in GitHub Desktop.
<script id="vertexShader" type="x-shader/x-vertex">
varying vec3 vNormal;
void main()
{
vNormal = normalize( normalMatrix * normal );
gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
}
</script>
<!-- fragment shader a.k.a. pixel shader -->
<script id="fragmentShader" type="x-shader/x-vertex">
varying vec3 vNormal;
void main()
{
float intensity = pow( 0.7 - dot( vNormal, vec3( 0.0, 0.0, 1.0 ) ), 4.0 );
gl_FragColor = vec4( 1.0, 1.0, 1.0, 1.0 ) * intensity;
}
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment