5
\$\begingroup\$

I am updating one of my shaders to a version of OpenGL/GLSL that doesn't automatically provide gl_NormalMatrix (for educational purposes; I'm not ripping out working code for the sake of it). Therefore, I need to compute my own normal matrix on the CPU and pass it in.

I understand that a separate normal matrix is used to avoid issues with non-uniform scaling affecting the direction of normals. However, I've noticed that in my code I never perform any scaling let alone a non-uniform one. So, I'm tempted to use the upper left 3x3 sub-matrix for transforming my normals and calling it a day (perhaps normalising them to allow for uniform scaling).

My program assumes that every mesh it loads is already at the correct size, with no scaling required.

Will I soon run into something that requires scaling (uniform or otherwise), or is there another reason for using a separate normal matrix that I haven't realised?

\$\endgroup\$

1 Answer 1

6
\$\begingroup\$

You're not missing anything.

The normal matrix exists in case the upper-left 3x3 of your regular model-view transformation is unsuitable for transforming normals (that is, contains non-uniform scale or other craziness).

If you know the upper-left 3x3 is always suitable for use in the transformation of normals, there's no reason to bother with a separate "normal matrix."

Most applications of 3D graphics for games can use the upper-left 3x3 just fine. It's broader, more general 3D graphics uses that more often have a need for a distinct normal matrix.

\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .