Skip to content

Instantly share code, notes, and snippets.

@izumiikezaki
Created March 6, 2019 02:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save izumiikezaki/dc12d8c7f7a18a4dae6ab2c33f50e56d to your computer and use it in GitHub Desktop.
Save izumiikezaki/dc12d8c7f7a18a4dae6ab2c33f50e56d 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;
void main()
{
if(gl_FrontFacing==true){gl_FragColor = vec4(abs(vNormal), 1.0);}
else{gl_FragColor = vec4(1.0-abs(vNormal), 1.0);}
}
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment