In this article we look at applying various types of shading to 3D objects.
Shading is a term that refers to how a 3D object is lit. Lighting an object is used to highlight the depth and shape of an object, and for such a simple effect it adds a lot to the realism of the 3D scene.
Cell shading attempts to recreate the look of a hand drawn cartoon image. It does this by shading the object with a few discreet shades of colour. The object is also outlined with a solid line. This effect has been used by a number of games to achieve a distinctive anime style.
Flat shading is a simple effect where each polygon has a single shade. For high polygon objects this type of shading can be quite effective, but for low polygon objects it makes the individual polygons stand out. It is very simple to compute though, so for scenes with a lot of individual objects flat shading may be the best choice.
Phong shading applies a lighting value to each individual pixel. This means that, unlike flat shading, phong shading looks good on high and low polygon models. Because each pixel has to have its own individual shade calculated, Phong shading can be quite expensive.
Check out the online demo here, and download the source code here.