<blockquote>
  <p>First, I cannot imagine how could a vertex have a normal,...</p>
</blockquote>

<p>Welcome to the exciting field of computer graphics. The first thing that might lead to your confusion is to think about a vertex too much as a point in space in a geometrical way. ---> A 3d point can't have normal since it does not have a face. 
But the way you should think about it is more like a checkpoint that contains all information of an arbitrary 3d curve at a certain position. </p>

<blockquote>
  <p>... and second, when calculate the reflection lights, shouldn't I use the normal of a face? </p>
</blockquote>

<p>What happens if you want to render a perfect sphere that can only be represented by a limited set of triangles? It will look like the one in the middle in <a href="https://blender.stackexchange.com/questions/13554/applied-boolean-modifier-leaving-shading-artifacts-with-flat-shading?rq=1">this question</a>. The flat surfaces are clearly visible, but that is not what you want. You can improve this by drastically increasing the triangle count, but that comes with a huge performance impact and memory footprint. </p>

<p>The solution here is using <strong>vertex normals</strong>. To understand, why this is a solution, you need to know a little bit about how the <a href="https://www.khronos.org/opengl/wiki/Rendering_Pipeline_Overview" rel="noreferrer">render pipeline</a> works. The most important parts for your understanding are vertex processing, rasterization, and the pixel/fragment shader.</p>

<p>Vertex processing is the first programable (in modern APIs) step in the pipeline and is mostly used to reposition your vertices so that your 3d world is displayed correctly on a 2d display. Therefore you apply some mathematical corrections (perspective for example) to your vertex positions. You can do a lot more, but that is not important here. What is important is, that the vertex processor does not know to which triangle a vertex belongs. He sees it in total isolation. Therefore, he can not calculate any face normals, so you have to provide it in some way, for example by adding it as vertex attribute.</p>

<p>After some optional pipeline steps, you get to the rasterizer. Its job is to turn your triangles into actual pixels on your screen. The information he gets are three vertices that form a triangle. Now here is, where the magic happens. For each pixel, he interpolates the properties of the three vertices and passes them to the final step, the pixel shader (also programable in modern APIs). So if your vertices had normals, you will have an interpolated normal for each pixel of your triangle. This enables you to render perfectly smooth surfaces (or at least fake them) since you can perform the lighting calculation for each pixel with individual normals in the pixel shader.</p>

<p>This is why you need vertex normals. The vertices are checkpoints that hold information about your surfaces at specific points. You connect these points to triangles. The information in between is interpolated by the rasterizer. So you essentially describe a whole triangle-shaped field of normals with its three edge values. </p>

<p>However, even if you want to render flat surfaces, you might still need vertex normals. As I said before, the vertex processor does not know anything about triangles, so you can not calculate any surface normals there. So you have to pass them in somehow. There are other ways, but attaching the normals to the vertices is usually the best and easiest solution.</p>

<p><strong>Additional note:</strong> You do not necessarily need to perform the lighting calculation in the pixel shader. You can also do this in the vertex stage. So you need vertex normals again ;). This is called Gouraud Shading and gives you a performance boost since you do not need to perform the light calculations per pixel. However, the visual quality of curved surfaces suffers from that. For flat surfaces, you should not see any differences.</p>

CC BY-SA 4.0
2022-11-03T09:50:34.963Z
great explanation, thank you. So what you are saying is that a vertex is not just a point in space, but a point on a *surface* in space, and the normal tells us the orientation of the surface, which can then be used for whatever purpose in creating an image?
danmcb
CC BY-SA 4.0
2022-11-03T10:21:56.830Z
@danmcb Correct. As additional info, here is how [Wikipedia describes it](https://en.wikipedia.org/wiki/Vertex_(computer_graphics)): "A vertex (plural vertices) in computer graphics is a data structure that describes certain attributes, like the position of a point in 2D or 3D space, or multiple points on a surface."
wychmaster
CC BY-SA 4.0
2020-05-29T08:15:41.897Z
So, if I take a vertex, and assign it a "average" normal which calculate by all the faces it connect, then use this to do the lighting calculation, the result will be more smooth, right? Does tools like blender use vertex normal to make a low poly looks more smooth?
ravenisadesk
CC BY-SA 4.0
2020-05-29T08:20:02.563Z
As your suggestion, can I understand that vertices in graphics (for example glsl) are data somehow related to the geometry points, so it can represent any thing, that why I always see colors put into a VBO?
ravenisadesk
CC BY-SA 4.0
2020-05-29T09:14:06.317Z
First question: I don't know for sure how blender does it since I haven't really worked with it, nor have I looked into the code, but I guess they do it that way. However, calculating the "average normal" is not as trivial as you might think. [See for example this question](https://computergraphics.stackexchange.com/questions/9702/calculate-normals-from-vertices/9705#9705).
wychmaster
CC BY-SA 4.0
2020-05-29T09:27:16.557Z
Second question: To my understanding, a vertex is just a data point with arbitrary attributes. Not sure if this is  the correct technical definition. However, as you said, the data can be anything. Everything attribute you add to your vertex will be available in the vertex processing step of the graphics pipeline (assuming you coded it correspondingly). You can use and modify this data there and optionally pass it down the pipeline. For example, the color attribute you mentioned is a common tutorial to render a triangle with smooth color transition. Every vertex there has a different color...
wychmaster
CC BY-SA 4.0
2020-05-29T09:28:26.993Z
... and the interpolation happens during rasterization. The fragment shader just passes the unmodified value from the rasterizer to the output.
wychmaster
CC BY-SA 4.0
2020-05-29T12:02:39.797Z
@ravenisadesk If you're interested in this stuff, it might be fun to check out the .OBJ file format for some details on how these things actually get stored. Basically, an .OBJ stores a series of points (as X,Y,Z coordinates), then a series of faces (as triangles between the previously defined points). From those, renderers can pre-calculate the normal vector for each face and, subsequently, each point.
Josh Eller
CC BY-SA 4.0
2020-05-29T14:12:16.493Z
@JoshEller, great suggestion.
ravenisadesk
CC BY-SA 4.0
2020-05-29T07:00:02.767Z
2020-05-29T07:00:02.767Z
wychmaster
<p>I'm new to the graphics area, and when it comes to the light part, the concept of vertex normals confuses me a lot.</p>

<p>First, I cannot imagine how a vertex could have a normal, and second, when calculating the reflection lights, shouldn't I use the normal of a face?</p>

<p>So, can someone help me understand what a vertex normal is, what it is used for, and how it compares to a face normal?</p>

<lighting>
What is a vertex normal used for?
ravenisadesk
# What is a vertex normal used for?

(Asked by: username_0 on 2020-05-29)

I'm new to the graphics area, and when it comes to the light part, the concept of vertex normals confuses me a lot.

First, I cannot imagine how a vertex could have a normal, and second, when calculating the reflection lights, shouldn't I use the normal of a face?

So, can someone help me understand what a vertex normal is, what it is used for, and how it compares to a face normal?

**Tags:** lighting


---

## 1 answers

### Answer by username_1 on 2020-05-29. Score: 11 | Accepted answer

> First, I cannot imagine how could a vertex have a normal,...

Welcome to the exciting field of computer graphics. The first thing that might lead to your confusion is to think about a vertex too much as a point in space in a geometrical way. ---> A 3d point can't have normal since it does not have a face.
But the way you should think about it is more like a checkpoint that contains all information of an arbitrary 3d curve at a certain position.

> ... and second, when calculate the reflection lights, shouldn't I use the normal of a face?

What happens if you want to render a perfect sphere that can only be represented by a limited set of triangles? It will look like the one in the middle in [this question](https://blender.stackexchange.com/questions/13554/applied-boolean-modifier-leaving-shading-artifacts-with-flat-shading?rq=1). The flat surfaces are clearly visible, but that is not what you want. You can improve this by drastically increasing the triangle count, but that comes with a huge performance impact and memory footprint.

The solution here is using **vertex normals**. To understand, why this is a solution, you need to know a little bit about how the [render pipeline](https://www.khronos.org/opengl/wiki/Rendering_Pipeline_Overview) works. The most important parts for your understanding are vertex processing, rasterization, and the pixel/fragment shader.

Vertex processing is the first programable (in modern APIs) step in the pipeline and is mostly used to reposition your vertices so that your 3d world is displayed correctly on a 2d display. Therefore you apply some mathematical corrections (perspective for example) to your vertex positions. You can do a lot more, but that is not important here. What is important is, that the vertex processor does not know to which triangle a vertex belongs. He sees it in total isolation. Therefore, he can not calculate any face normals, so you have to provide it in some way, for example by adding it as vertex attribute.

After some optional pipeline steps, you get to the rasterizer. Its job is to turn your triangles into actual pixels on your screen. The information he gets are three vertices that form a triangle. Now here is, where the magic happens. For each pixel, he interpolates the properties of the three vertices and passes them to the final step, the pixel shader (also programable in modern APIs). So if your vertices had normals, you will have an interpolated normal for each pixel of your triangle. This enables you to render perfectly smooth surfaces (or at least fake them) since you can perform the lighting calculation for each pixel with individual normals in the pixel shader.

This is why you need vertex normals. The vertices are checkpoints that hold information about your surfaces at specific points. You connect these points to triangles. The information in between is interpolated by the rasterizer. So you essentially describe a whole triangle-shaped field of normals with its three edge values.

However, even if you want to render flat surfaces, you might still need vertex normals. As I said before, the vertex processor does not know anything about triangles, so you can not calculate any surface normals there. So you have to pass them in somehow. There are other ways, but attaching the normals to the vertices is usually the best and easiest solution.

**Additional note:** You do not necessarily need to perform the lighting calculation in the pixel shader. You can also do this in the vertex stage. So you need vertex normals again ;). This is called Gouraud Shading and gives you a performance boost since you do not need to perform the light calculations per pixel. However, the visual quality of curved surfaces suffers from that. For flat surfaces, you should not see any differences.

> **Comments:**
> **username_0**: So, if I take a vertex, and assign it a "average" normal which calculate by all the faces it connect, then use this to do the lighting calculation, the result will be more smooth, right? Does tools like blender use vertex normal to make a low poly looks more smooth?  
> **username_0**: As your suggestion, can I understand that vertices in graphics (for example glsl) are data somehow related to the geometry points, so it can represent any thing, that why I always see colors put into a VBO?  
> **username_1**: First question: I don't know for sure how blender does it since I haven't really worked with it, nor have I looked into the code, but I guess they do it that way. However, calculating the "average normal" is not as trivial as you might think. [See for example this question](https://computergraphics.stackexchange.com/questions/9702/calculate-normals-from-vertices/9705#9705).  
> **username_1**: Second question: To my understanding, a vertex is just a data point with arbitrary attributes. Not sure if this is  the correct technical definition. However, as you said, the data can be anything. Everything attribute you add to your vertex will be available in the vertex processing step of the graphics pipeline (assuming you coded it correspondingly). You can use and modify this data there and optionally pass it down the pipeline. For example, the color attribute you mentioned is a common tutorial to render a triangle with smooth color transition. Every vertex there has a different color...  
> **username_1**: ... and the interpolation happens during rasterization. The fragment shader just passes the unmodified value from the rasterizer to the output.  
> **username_3**: @username_0 If you're interested in this stuff, it might be fun to check out the .OBJ file format for some details on how these things actually get stored. Basically, an .OBJ stores a series of points (as X,Y,Z coordinates), then a series of faces (as triangles between the previously defined points). From those, renderers can pre-calculate the normal vector for each face and, subsequently, each point.  
> **username_0**: @username_3, great suggestion.  
> **username_2**: great explanation, thank you. So what you are saying is that a vertex is not just a point in space, but a point on a *surface* in space, and the normal tells us the orientation of the surface, which can then be used for whatever purpose in creating an image?  
> **username_1**: @username_2 Correct. As additional info, here is how [Wikipedia describes it](https://en.wikipedia.org/wiki/Vertex_(computer_graphics)): "A vertex (plural vertices) in computer graphics is a data structure that describes certain attributes, like the position of a point in 2D or 3D space, or multiple points on a surface."  

---

