0
$\begingroup$

I know the process for regular vertices is something like: model coordinates to clip space via the "MVP" matrix transformation, then perspective division, screen-space mapping, and finally rasterization.

I also know that normals are to be transformed differently. Specifically, to preserve orthogonality with the surface, they are multiplied by the transposed inverse of the matrices that would be applied to regular vectors.

My question is: in typical graphics APIs such as OpenGL, how are the surface normals handled? Do they also go through MVP?

$\endgroup$
1
  • $\begingroup$ I deleted my original comment since it confuses the issue. $\endgroup$
    – pmw1234
    Commented Jun 10 at 12:33

2 Answers 2

2
$\begingroup$

Basically yes, but no. For example, if you do lighting calculations you need to bring the normals and the light sources into the same coordinate system for the calculations to be correct. Which coordinate system you choose is up to you. Because the view coordinate system has some advantages when looking at the choices (numerical stability and so on), it's chosen most of the time. This means you need to do ${V^{-1}}^T\cdot{M^{-1}}^T\cdot \mathbf{n}$ at some point in your pipeline (most likely a shader), analogous to $V\cdot M \cdot\mathbf {p}$. Your normals go through "MV" so to speak. It's only that normals rarely need to go through "P" too, because that would simply mean you project them into screen space (and why would you do that?).

$\endgroup$
0
1
$\begingroup$

They do not go through MVP...

If you need them in worldSpace, you can multiply them by the transposed inverse of the model matrix.

If you need them in ViewSpace, you can multiply them by the transposed inverse of the model view matrix (MV).

The projection matrix is therefore not used.

Take a look at this: https://stackoverflow.com/questions/13654401/why-transform-normals-with-the-transpose-of-the-inverse-of-the-modelview-matrix

$\endgroup$
1
  • $\begingroup$ You are welcome $\endgroup$
    – Thomas
    Commented Jun 10 at 20:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.