Created
August 3, 2023 06:50
-
-
Save otanodesignco/4a739b7e21fac0711d568a219eb4bfd1 to your computer and use it in GitHub Desktop.
How to transform normals to world space for lighting
This file contains hidden or 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
out vec3 vWorldSpaceNormal; | |
void main() | |
{ | |
vec4 worldSpaceNormal = modelMatrix * vec4( normal, 0.0 ); | |
vWorldSpaceNormal = normalize( worldSpaceNormal.xyz ); | |
gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment