Skip to content

Instantly share code, notes, and snippets.

@izumiikezaki
Last active March 12, 2019 00:04
Show Gist options
  • Save izumiikezaki/fe120d56f72b007e31754389a83158a6 to your computer and use it in GitHub Desktop.
Save izumiikezaki/fe120d56f72b007e31754389a83158a6 to your computer and use it in GitHub Desktop.
<script type="x-shader/x-vertex" id="vshader">
varying vec3 vNormal;
varying vec3 pos;
void main()
{
vNormal=normalMatrix*normal;
pos = position;
gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);
}
</script>
<script type="x-shader/x-fragment" id="fshader">
varying vec3 vNormal;
varying vec3 pos;
vec3 color1 = vec3(0.0, 32.0/255.0, 94.0/255.0);
void main()
{
float z=1.0-(vNormal.z);
if(gl_FrontFacing==true){
gl_FragColor = vec4(color1+1.0-(vNormal.z), 1.0);
}
else{
gl_FragColor = vec4(color1+(vNormal.z), 1.0);
}
}
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment