# How exactly does Gouraud shading apply color across a polygon? Does it do it by pixel or is it some other method?

I'm a super beginner to GFX. So far I've learned about 3 shading models when rendering meshes The first is Flat Shading. I seem to understand this, from my understanding, you take the normal of the face/polygon, apply your lighting model based on that, and the light angle, and other parameters and based on what you get, shade your polygon with a single color, done.

I've learned about Phong Shading as well. Apparently Phong Shading takes the normals of the vertices of the polygon, and interpolates them for each pixel, thus sort of 'creating' a normal per every pixel, and shade accordingly. It is shaded per pixel, and as such you get smooth results

Gouraud shading is what I am most confused by. I referred to many online sources including this one and what I dont understand is how exactly the polygon is shaded? Is it shaded per pixel?

From my understanding, Gouraud is the same as Phong shading except that unlike Phong interpolating vertex normals, and creates normals for every pixel and shading each pixel, Gouraud interpolates just the vertex normals of the polygon.

Im not quite sure what it does after that. Does it take these interpolated vertex normals and shade the polygon in a single color? Does it shade pixel by pixel just like Phong?

The difference is in the number of lighting calculations done. Where the lighting calculation produces some color.

Flat does one per face, uses the color across the face.

Gourand does 3 (for a triangle, one for each vertex), interpolates the color across the face.

Phong does a light calculation for every pixel/fragment (where the normal is interpolated across the face). • So essentially gouraud calculates a color at 3 points and interpolates each of those 3 colors together for each pixel making up the image of the triangle?
– Hash
Apr 25, 2021 at 19:25
• Yup, with barycentric coordinates color = u * postLitColorV1 + v * postLitColorV2 + w * postLitColorV3. You can often tell when the triangles are large. I added an image. So you can see the differences in the specular highlight, bright where the normal is perpendicular to the viewing angle. In gourand this would only be at that one vertex, but in phong the normal is smoothly interpolated across the face Apr 25, 2021 at 21:39
• What exactly does postLitColor mean here and what is a Barycentric coordinate mean in this context? Ive tried reading into the latter, and Im quite not able to grasp it and how it gives us the triangle color And to make sure, Phong : Calculates per pixel, shades each pixel, Gouraud : Calculates 3 vertices, shades each pixel after interpolating them based on their distance to the 3 vertices right?
– Hash
Apr 26, 2021 at 15:07
• postLitColor refers to the color obtained from the lighting equation at that particular vertex, since that is the only time the lighting model is evaluated in Gouraud shading. Once you have the color values for the three vertices, you can linearly interpolate them for any point inside the triangle using a local coordinate system (u,v,w) where V1=(1,0,0), V2=(0,1,0) and V3=(0,0,1). The Wikipedia article on Barycentric coordinates has a section on triangular coordinates and conversion to/from Cartesian coordinates. Apr 26, 2021 at 18:30
• A simple example of a possible light equation would be postLitColor= diffuseColor * dot(lightDir, normal(x)), where diffuseColor is a constant set by you, lightDir is a 3 component vector giving a directional light, and normal(x) evaluates the normal of the surface at x. Apr 26, 2021 at 19:47