Shading Models

Flat Shading

Just one color is computed and used to shade a triangle. That color can be obtained for example by using the illumination function (e.g. one combining the ambient, diffuse and specular light as described in earlier notes) at one point on the triangle's (typically a vertex). This makes shading calculations extremely fast, but leads to images with discontinuities along edges of the triangles (faceted look characteristic to older computer games). Here is a cow rendered using flat shading. Individual triangles can be seen right away.

Of course, one can reduce the problem by increasing the number of triangles used to approximate the cow. Here is an example: it uses 16 times more triangles than before; they are still flat shaded (you still should be able to see the discontinuities), but the result is much better. However, be aware that we have a lot more triangles now, so the rendering is much slower. In particular, it requires sixteen times more illumination evaluations than the previous image. Using more triangles is not a way to go in interactive applications.

Gouraud Shading

The main drawback of the flat shading model are the discontinuities of color along the boundaries of the triangles. Gouraud shading deals with this problem by using linear interpolation to shade triangles. This produces continuous color across the boundaries of triangles but, in general, does not do a good job capturing highlights: at the picture below (the familiar cow, this time Gouraud shaded) they appear somewhat blocky and artificial. However, it's better than the flat shaded cow with the same number of triangles (the first image) and much cheaper to render than the cow modelled with small triangles (second image).

Phong shading

Phong shading increases the quality of the images by doing linear interpolation of normal vectors rather than of the color. This is better since the illumination heavily depends on the normal vector (look at the diffuse/specular light formulas), in a complicated way which is not captured well by linear interpolation of the intensity. This is a high quality alternative to flat and Gouraud shading: the highlights are much better shaped and illumination looks much more natural. However, the rendering cost is in this case very high: in particular, the illumination function has to be computed for each pixel covered by the object, not for each vertex. The cow images have around 300000 pixels (probably at least 100000 are covered by the cow, the rest is background), while the number of vertices of all triangles is only 2900. It is also much harder to implement in hardware (and normally is not). This is why there is no image of a cow rendered using Phong shading now (but I will post one soon). difference between the Phong-shaded and Gouraud-shaded cow is hardly visible, since the cow model is quite detailed.


Here is another example: a tetrahedron.
Flat shading


Gouraud shading


Phong shading


Notice the specular highlight on the right face in the Phong-shaded image. Such highlights are impossible to capture with Gouraud or flad shading. Also, note the smoothness of the image (the edges are invisible).