Skip to content

Instantly share code, notes, and snippets.

@gsimone
Last active January 4, 2022 14:47
Show Gist options
  • Save gsimone/270d6474da3bb0d2742ccb8447efc237 to your computer and use it in GitHub Desktop.
Save gsimone/270d6474da3bb0d2742ccb8447efc237 to your computer and use it in GitHub Desktop.
// world position
vPositionW = vec3( vec4( position, 1.0 ) * modelMatrix);
// world normal
vNormalW = normalize( vec3( vec4( normal, 0.0 ) * modelMatrix ) );
// world camera direction
vec3 viewDirectionW = normalize(cameraPosition - vPositionW);
// fresnel, calc with dot mult between view and normal
float fresnel = dot(viewDirectionW, vNormalW);
// then clamp
fresnelTerm = clamp(1.0 - fresnelTerm, 0., 1.);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment