<p>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 <span class="math-container">${V^{-1}}^T\cdot{M^{-1}}^T\cdot  \mathbf{n}$</span> at some point in your pipeline (most likely a shader), analogous to <span class="math-container">$V\cdot M \cdot\mathbf {p}$</span>. Your normals go through &quot;MV&quot; so to speak. It's only that normals rarely need to go through &quot;P&quot; too, because that would simply mean you project them into screen space (and why would you do that?).</p>

CC BY-SA 4.0
2024-06-10T10:26:24.327Z
2024-06-10T10:26:24.327Z
taiyo
<p>They do not go through MVP...</p>
<p>If you need them in worldSpace, you can multiply them by the transposed inverse of the model matrix.</p>
<p>If you need them in ViewSpace, you can multiply them by the transposed inverse of the model view matrix (MV).</p>
<p>The projection matrix is therefore not used.</p>
<p>Take a look at this: <a href="https://stackoverflow.com/questions/13654401/why-transform-normals-with-the-transpose-of-the-inverse-of-the-modelview-matrix">https://stackoverflow.com/questions/13654401/why-transform-normals-with-the-transpose-of-the-inverse-of-the-modelview-matrix</a></p>

CC BY-SA 4.0
2024-06-07T06:39:09.183Z
2024-06-10T07:40:27.060Z
2024-06-10T07:40:27.060Z
Thomas
<p>I know the process for regular vertices is something like: model coordinates to clip space via the &quot;MVP&quot; matrix transformation, then perspective division, screen-space mapping, and finally rasterization.</p>
<p>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.</p>
<p>My question is: in typical graphics APIs such as OpenGL, how are the surface normals handled? Do they also go through MVP?</p>

<opengl><matrix><vectors>
How are surface normals dealt with in the graphics pipeline?
Scene
# How are surface normals dealt with in the graphics pipeline?

(Asked by: username_0 on 2024-06-07)

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?

**Tags:** opengl, matrix, vectors


---

## 2 answers

### Answer by username_1 on 2024-06-10. Score: 2 | Accepted answer

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?).


---

### Answer by username_2 on 2024-06-07. Score: 1

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>


---

