Last active
January 4, 2022 14:47
-
-
Save gsimone/270d6474da3bb0d2742ccb8447efc237 to your computer and use it in GitHub Desktop.
This file contains 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
// 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