I'm doing lighting in world space (not in eye space), so I set the normal matrix as follows:

modelProgram->setUniform( "NormalMatrix", inverse(transpose(mat3(modelMatrix))) );

Now I noticed that all the tutorials set the normal matrix as the inverse transpose of the ModelView matrix. This also means they do lighting in eye space, right?

Do I have to do lighting in eye space when using the normal matrix? I actually do normal mapping too if it matters.


1 Answer 1


It's common for people to compute lighting in eye space because of how the specular component of lighting in the Phong model is calculated. Doing the calculation in view space, allows you to avoid a vector subtraction in the vertex shader, a basically negligible optimization.

If you were instead to do the calculations in world space, which you absolutely can, you would just additionally need to pass to your shader the eye's direction (or compute it from the view matrix within your shader).

It is certainly possible to do lighting in world space, and if you find that more intuitive you should go that route.

  • \$\begingroup\$ Then it is okay to set the normal matrix as the inverse transpose of the ModelMatrix as well? \$\endgroup\$
    – McLovin
    Commented Jan 16, 2016 at 4:32
  • \$\begingroup\$ Yes as long as you're aware throughout the rest of your shader that the normals are in world space. \$\endgroup\$ Commented Jan 16, 2016 at 4:33

You must log in to answer this question.

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