Created
May 22, 2014 14:31
-
-
Save markgajdosik/43626464432b843f747f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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