Skip to content

Instantly share code, notes, and snippets.

@otanodesignco
Created July 29, 2023 17:22
Show Gist options
  • Save otanodesignco/0eb85e1fea7a7e2309f758b2f02ac912 to your computer and use it in GitHub Desktop.
Save otanodesignco/0eb85e1fea7a7e2309f758b2f02ac912 to your computer and use it in GitHub Desktop.
view direction
out vec3 vViewDirection; // varying to send to the fragment shader
void main()
{
vec4 viewDirection = modelViewMatrix * vec4( position, 1.0 );
vViewDirection = viewDirection.xyz; // set view direction per pixel
gl_Position = projectionMatrix * viewDirection;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment