<p>RGB &quot;Colors&quot; contain chromaticity(color) and luminance(brightness), normal vectors contain direction and magnitude.</p>
<p>Gouraud shading approximates color gradients.</p>
<p>Phong shading approximates surface gradients.</p>
<p>Imagine a large triangle with a small specular highlight at the center and all 3 vertex positions have normal vectors pointing away from the highlight so are only dimly lit.</p>
<p>Interpolating the color will completely miss the highlight and only give values between those at the 3 vertex positions.</p>
<p>Interpolating the normal vectors will force a change of direction in the vector so that the highlight is visible.</p>
<p>Also, interpolation of normal vectors changes their length which can be recalculated in the fragment shader to help improve the approximation.  But there is very little we can do to help correct interpolated colors.</p>
<p>Edit: Why interpolating between two vectors changes length.
To interpolate vectors we use the formula <span class="math-container">$N_c = N_a\alpha+N_b(1-\alpha)$</span> where <span class="math-container">$N_a$</span> and <span class="math-container">$N_b$</span> are the two vectors being interpolated. This includes the sum of two vectors. Adding vectors can be thought of visually as placing them end to end, so the sum of two vectors results in a third vector with its own length resulting from the angle between the two vectors.</p>
<p><a href="https://i.sstatic.net/bUp3b.gif" rel="nofollow noreferrer"><img src="https://i.sstatic.net/bUp3b.gif" alt="enter image description here" /></a></p>
<p>As simon f pointed out in comments my description of mach banding is poorly worded and misleading. See the comment below. Here is an image of the effect in action.
<a href="https://i.sstatic.net/n5Axi.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/n5Axi.png" alt="enter image description here" /></a></p>

CC BY-SA 4.0
2021-07-22T12:42:07.713Z
Why would interpolation of normal vectors change their length? Aren't normal vectors by definition have a length of 1? What causes their length to change from 1 to something else when they are interpolated?
Hash
CC BY-SA 4.0
2021-07-22T13:40:53.363Z
I added a brief explanation of vector sums and their length.
pmw1234
CC BY-SA 4.0
2021-07-23T12:06:30.533Z
@pmw1234 re *"Additionally, interpolated colors tend have a nice perfect change from one color to another across the surface of the triangle, this causes an effect called "mach banding" where it looks like there are color bands when the transition is actually smooth."*   The Mach bands occur at the boundaries where triangles meet because the eye picks up the discontinuity in the rates of change from triangle to triangle
Simon F
CC BY-SA 4.0
2021-07-23T12:24:07.063Z
I agree, I edited the answer and linked an example.
pmw1234
CC BY-SA 4.0
2021-07-23T19:47:22.567Z
@SimonF what is referred by rate of change of triangle to triangle? Is it how the lighting values calculated in gouraud shading is calculated per vertex hence moving from triangle to triangle we see "changes" and discontinuities in color?
Hash
CC BY-SA 4.0
2021-07-23T19:48:26.790Z
@pmw1234 Also in the formula  you provided for interpolation, what is the symbol alpha referring to? And am I right in assuming Nc is a vector in the "middle" of the line connecting vector Na and vector Nb?
Hash
CC BY-SA 4.0
2021-07-28T09:39:38.597Z
@hash *"what is referred by rate of change of triangle to triangle"* I mean dRGB/dPixel.  As you step across a triangle pixel by pixel in given direction (eg x), with Gouraud shading you have a fixed increment in colour values (ie constant dRGB/dPixel). In the neighbouring triangle, that rate will (probably) be different.  Even though the RGBs themselves will be "continuous" as you go from triangle to triangle, the rates of change *will not* be. The human visual system is very good at identifying these 1st derivative discontinuities ( probably to help avoid being eaten by lions/wolves etc).
Simon F
CC BY-SA 4.0
2021-07-28T19:43:30.613Z
@SimonF Im assuming the rate in a specific triangle is constant due to the fact that colors are linearly interpolated from the vertices right? But why is it that another triangle  would have a different rate of change? Every triangle uses linear interpolation of colors from the vertices so why would the rate of color change be diffeerent? Is it because dRGB might be different because different triangles will have different colors calculated at the vertices?
Hash
CC BY-SA 4.0
2021-07-21T14:32:29.557Z
2021-07-23T12:23:05.483Z
2021-07-23T12:23:05.483Z
pmw1234
<p>View angle changes all the time. In goraud shading the color sampling is done once per vertex.</p>
<p>But in phong shading the angle between view angle and normal is calculated for every pixel.</p>
<p>Why would that be different. Well simply because angle changes, and its cosine, is not a linearly changing quantity. (Ill draw a picture later when i get to a computer)</p>
<p>Imagine a large plane diffuse plane. Then the diffuse shading you see is based on the dot product of the normal and the normalized vector to light. Now imagine the light is in the middle of the plane. If you only have verices at the corners of the plane you get a uniform intensity. If you subdivide once you do not. If you subdivide by pixel you get phong shading and due to the dot prduct not being linear a different answer.</p>
<p><a href="https://i.sstatic.net/75IWx.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/75IWx.png" alt="enter image description here" /></a></p>
<p><strong>TL;DR</strong></p>
<p>A noninear function does not approximate well with a linear function.</p>

CC BY-SA 4.0
2021-07-22T18:18:24.730Z
If the large plane is lit uniformly as you said, such that every point on the plane is hit by the same 'intensity' of light, why would there be a specular highlight on a particular point on the plane?
Hash
CC BY-SA 4.0
2021-07-22T18:30:35.737Z
@Hash not uniformly, symmetrically. In real life planes dont become uniformly lit just as long as corners are lit the same way.
joojaa
CC BY-SA 4.0
2021-07-22T19:11:02.443Z
What do you mean exactly by 'symmetrically' in 'symmetrically lit' here? Sorry I am a bit confused
Hash
CC BY-SA 4.0
2021-07-22T19:22:21.250Z
Any light source that lights the object so that the color at corners is the same. Like say a point light smack in the middle of a square, whike your camera is pointing down smack in the middle of the square. In real life you get this nice radial falloff. As you do with phong, with goraud you get a flat color.
joojaa
CC BY-SA 4.0
2021-07-23T19:28:31.157Z
Could it be that @Hash is unaware of radiometric concepts? If this is the case please read [Chapter 5 of PBRT](https://www.pbr-book.org/3ed-2018/Color_and_Radiometry/Radiometry) as an introduction. Otherwise, I apologize.

In the rendering equation, there is a cosine in the irradiance term. Hence, even if the incoming light radiance and the brdf are constant everywhere, the reflected radiance will be non-linear, which cannot be expressed as a linear combination such as the one carried out by Gouraud shading.

This is exactly what is being depicted in this answer.
vgs
CC BY-SA 4.0
2021-07-23T19:39:12.570Z
@vgs probably, hard to say. Some missing mathematical basis maybe.
joojaa
CC BY-SA 4.0
2021-07-24T10:45:54.420Z
@vgs So since cosine which I assume is involved in lighting equations since we do a dot product of vertex normal and normal of the light ray is not linear, a linear interpolation of color would thus be inaccurate?
Hash
CC BY-SA 4.0
2021-07-24T10:48:20.920Z
@Hash yes. I am showing just one source since one source us enough to explain difference. Also if the vertex bormal is turning along with camera angle, angle change is also not linear. As is the reflection direction. (Note wjen you have rotation of any kind you can bet the solution is nonlinear as rotation is sin and cos functions) But basically all of this is non linear. Note though nobody is really doing goraud shading anymore, except maybe for baking vertex coloring which results in pretty much the same issue.
joojaa
CC BY-SA 4.0
2021-07-24T10:56:00.247Z
Also protip if you havent got conclusive proof to the contrary always assume things are nonlinear. Just because you have easier time to think linear does not mean thats a good assumption; Motivate linearity first.
joojaa
CC BY-SA 4.0
2021-07-24T17:02:05.397Z
@joojaa Why would the normal of a vertex change if the camera angle changes? Isnt the vertex normal inherent to the vertex itself and where it is positioned in 3d space? Why does it change with a change in camera angle?
Hash
CC BY-SA 4.0
2021-07-24T17:10:17.980Z
@Hash because you are looking at the normal from a camera. The perspective tranformation makes it so that: 1. Paralell lines are nolonger parallel 2. The distribution of linear data has changed. As i said stop thinking about how things are linear they are not.
joojaa
CC BY-SA 4.0
2021-07-26T20:23:41.560Z
@joojaa By perspective transformation do you mean when all the meshes in the scene are perspective corrected and projected on the screen?
Hash
CC BY-SA 4.0
2021-07-26T20:30:22.390Z
@Hash when your camera has perspective yes.
joojaa
CC BY-SA 4.0
2021-07-22T16:40:56.610Z
2021-07-22T22:15:26.370Z
2021-07-22T22:15:26.370Z
joojaa
<p>I am struggling to understand as to why fundamentally triangles shaded through Gouraud shading and ones shaded through Phong shading look different.</p>
<p>From my understanding, Gouraud Shading, takes the vertices of a triangle. It calculates the color at each vertex with the help of vertex normals, and interpolates that color across the triangle per-pixel. Phong Shading calculates the normal at each vertex, and interpolates the normals across the triangle per-pixel and shades the said pixels using interpolated normals</p>
<p>Both involve interpolation. Why is it that interpolating normals produces a more realistic results, while interpolating the colors directly does not? What is it about the interpolation of colors that makes it less accurate?</p>
<p>Under the hood, isn't interpolating just a color similar to interpolating the normal and finding the color at every point? If not, intuitively how are they both different then?</p>

CC BY-SA 4.0
2021-07-21T10:31:34.463Z
Hint: Consider specular highlights.
Simon F
CC BY-SA 4.0
2021-07-21T10:36:22.747Z
@SimonF Yes I did see several clips where the specular highlights in Gouraud appear to be...concentrated near the vertexes for a lack of better words. I am assuming this happens because closer to the vertexes the colors would obviously be closer to that of the vertex's colors

But why doesn't a similar thing happen for Phong shading? Why won't the normals be closer to the vertex normals the closer we are to the vertex? Why wont a similar effect happen in Phong shading then?
Hash
<shading>
Gouraud Shading interpolates color across a triangle using vertex normals. Phong Shading interpolates normals. How are their end-results different?
Hash
# Gouraud Shading interpolates color across a triangle using vertex normals. Phong Shading interpolates normals. How are their end-results different?

(Asked by: username_0 on 2021-07-21)

I am struggling to understand as to why fundamentally triangles shaded through Gouraud shading and ones shaded through Phong shading look different.

From my understanding, Gouraud Shading, takes the vertices of a triangle. It calculates the color at each vertex with the help of vertex normals, and interpolates that color across the triangle per-pixel. Phong Shading calculates the normal at each vertex, and interpolates the normals across the triangle per-pixel and shades the said pixels using interpolated normals

Both involve interpolation. Why is it that interpolating normals produces a more realistic results, while interpolating the colors directly does not? What is it about the interpolation of colors that makes it less accurate?

Under the hood, isn't interpolating just a color similar to interpolating the normal and finding the color at every point? If not, intuitively how are they both different then?

**Tags:** shading

> **Comments:**
> **username_1**: Hint: Consider specular highlights.  
> **username_0**: @username_1 Yes I did see several clips where the specular highlights in Gouraud appear to be...concentrated near the vertexes for a lack of better words. I am assuming this happens because closer to the vertexes the colors would obviously be closer to that of the vertex's colors  But why doesn't a similar thing happen for Phong shading? Why won't the normals be closer to the vertex normals the closer we are to the vertex? Why wont a similar effect happen in Phong shading then?  

---

## 2 answers

### Answer by username_3 on 2021-07-22. Score: 4 | Accepted answer

View angle changes all the time. In goraud shading the color sampling is done once per vertex.

But in phong shading the angle between view angle and normal is calculated for every pixel.

Why would that be different. Well simply because angle changes, and its cosine, is not a linearly changing quantity. (Ill draw a picture later when i get to a computer)

Imagine a large plane diffuse plane. Then the diffuse shading you see is based on the dot product of the normal and the normalized vector to light. Now imagine the light is in the middle of the plane. If you only have verices at the corners of the plane you get a uniform intensity. If you subdivide once you do not. If you subdivide by pixel you get phong shading and due to the dot prduct not being linear a different answer.

[![enter image description here](https://i.sstatic.net/75IWx.png)](https://i.sstatic.net/75IWx.png)

**TL;DR**

A noninear function does not approximate well with a linear function.

> **Comments:**
> **username_0**: If the large plane is lit uniformly as you said, such that every point on the plane is hit by the same 'intensity' of light, why would there be a specular highlight on a particular point on the plane?  
> **username_3**: @username_0 not uniformly, symmetrically. In real life planes dont become uniformly lit just as long as corners are lit the same way.  
> **username_0**: What do you mean exactly by 'symmetrically' in 'symmetrically lit' here? Sorry I am a bit confused  
> **username_3**: Any light source that lights the object so that the color at corners is the same. Like say a point light smack in the middle of a square, whike your camera is pointing down smack in the middle of the square. In real life you get this nice radial falloff. As you do with phong, with goraud you get a flat color.  
> **username_4**: Could it be that @username_0 is unaware of radiometric concepts? If this is the case please read [Chapter 5 of PBRT](https://www.pbr-book.org/3ed-2018/Color_and_Radiometry/Radiometry) as an introduction. Otherwise, I apologize.  In the rendering equation, there is a cosine in the irradiance term. Hence, even if the incoming light radiance and the brdf are constant everywhere, the reflected radiance will be non-linear, which cannot be expressed as a linear combination such as the one carried out by Gouraud shading.  This is exactly what is being depicted in this answer.  
> **username_3**: @username_4 probably, hard to say. Some missing mathematical basis maybe.  
> **username_0**: @username_4 So since cosine which I assume is involved in lighting equations since we do a dot product of vertex normal and normal of the light ray is not linear, a linear interpolation of color would thus be inaccurate?  
> **username_3**: @username_0 yes. I am showing just one source since one source us enough to explain difference. Also if the vertex bormal is turning along with camera angle, angle change is also not linear. As is the reflection direction. (Note wjen you have rotation of any kind you can bet the solution is nonlinear as rotation is sin and cos functions) But basically all of this is non linear. Note though nobody is really doing goraud shading anymore, except maybe for baking vertex coloring which results in pretty much the same issue.  
> **username_3**: Also protip if you havent got conclusive proof to the contrary always assume things are nonlinear. Just because you have easier time to think linear does not mean thats a good assumption; Motivate linearity first.  
> **username_0**: @username_3 Why would the normal of a vertex change if the camera angle changes? Isnt the vertex normal inherent to the vertex itself and where it is positioned in 3d space? Why does it change with a change in camera angle?  
> **username_3**: @username_0 because you are looking at the normal from a camera. The perspective tranformation makes it so that: 1. Paralell lines are nolonger parallel 2. The distribution of linear data has changed. As i said stop thinking about how things are linear they are not.  
> **username_0**: @username_3 By perspective transformation do you mean when all the meshes in the scene are perspective corrected and projected on the screen?  
> **username_3**: @username_0 when your camera has perspective yes.  

---

### Answer by username_2 on 2021-07-21. Score: 1

RGB "Colors" contain chromaticity(color) and luminance(brightness), normal vectors contain direction and magnitude.

Gouraud shading approximates color gradients.

Phong shading approximates surface gradients.

Imagine a large triangle with a small specular highlight at the center and all 3 vertex positions have normal vectors pointing away from the highlight so are only dimly lit.

Interpolating the color will completely miss the highlight and only give values between those at the 3 vertex positions.

Interpolating the normal vectors will force a change of direction in the vector so that the highlight is visible.

Also, interpolation of normal vectors changes their length which can be recalculated in the fragment shader to help improve the approximation. But there is very little we can do to help correct interpolated colors.

Edit: Why interpolating between two vectors changes length.
To interpolate vectors we use the formula $N\_c = N\_a\alpha+N\_b(1-\alpha)$ where $N\_a$ and $N\_b$ are the two vectors being interpolated. This includes the sum of two vectors. Adding vectors can be thought of visually as placing them end to end, so the sum of two vectors results in a third vector with its own length resulting from the angle between the two vectors.

[![enter image description here](https://i.sstatic.net/bUp3b.gif)](https://i.sstatic.net/bUp3b.gif)

As username_1 f pointed out in comments my description of mach banding is poorly worded and misleading. See the comment below. Here is an image of the effect in action.
[![enter image description here](https://i.sstatic.net/n5Axi.png)](https://i.sstatic.net/n5Axi.png)

> **Comments:**
> **username_0**: Why would interpolation of normal vectors change their length? Aren't normal vectors by definition have a length of 1? What causes their length to change from 1 to something else when they are interpolated?  
> **username_2**: I added a brief explanation of vector sums and their length.  
> **username_1**: @username_2 re *"Additionally, interpolated colors tend have a nice perfect change from one color to another across the surface of the triangle, this causes an effect called "mach banding" where it looks like there are color bands when the transition is actually smooth."*   The Mach bands occur at the boundaries where triangles meet because the eye picks up the discontinuity in the rates of change from triangle to triangle  
> **username_2**: I agree, I edited the answer and linked an example.  
> **username_0**: @username_1 what is referred by rate of change of triangle to triangle? Is it how the lighting values calculated in gouraud shading is calculated per vertex hence moving from triangle to triangle we see "changes" and discontinuities in color?  
> **username_0**: @username_2 Also in the formula  you provided for interpolation, what is the symbol alpha referring to? And am I right in assuming Nc is a vector in the "middle" of the line connecting vector Na and vector Nb?  
> **username_1**: @username_0 *"what is referred by rate of change of triangle to triangle"* I mean dRGB/dPixel.  As you step across a triangle pixel by pixel in given direction (eg x), with Gouraud shading you have a fixed increment in colour values (ie constant dRGB/dPixel). In the neighbouring triangle, that rate will (probably) be different.  Even though the RGBs themselves will be "continuous" as you go from triangle to triangle, the rates of change *will not* be. The human visual system is very good at identifying these 1st derivative discontinuities ( probably to help avoid being eaten by lions/wolves etc).  
> **username_0**: @username_1 Im assuming the rate in a specific triangle is constant due to the fact that colors are linearly interpolated from the vertices right? But why is it that another triangle  would have a different rate of change? Every triangle uses linear interpolation of colors from the vertices so why would the rate of color change be diffeerent? Is it because dRGB might be different because different triangles will have different colors calculated at the vertices?  

---

