Shading models

A lighting model is a method for determining the color of a face at a certain point or, more precisely, over a small fragment of the face. It depends in part on the color assigned to the face. But it also depends on the orientation of the face with respect to the light sources — how much light energy falls on the fragment — and on the color and intensity of the light sources. Some lighting models also take account of the position of the viewer.

When a lighting model is applied to some surface fragment, we call this a lighting calculation. Lighting calculations tend to be expensive since they account for many factors in the scene, but they are also critical for realism.

A shading model provides rules for assigning color to all visible surfaces in the scene. To do this, it uses the colors obtained from select lighting calculations to paint the scene as a whole. The shading model is a strategy for using a lighting model effectively. For example, the flat shading model performs a single lighting calculation for every face, and paints the interior of the face uniformly with its color. Smooth shading calculations perform multiple lighting calculations per face.

The following program lets you choose between three standard shading models: flat, smooth, and Phong. The position of the point light source, coincident with the yellow sphere, is controlled with the sliders.

Some shading models

When you choose none from the dropdown menu, no shading model is applied. In this case, the objects are not sensitive to light, and they are painted uniformly with the color assigned to their material. It’s difficult to make out the three dimensionality of the torus and sphere. Shading — variation in brightness — is a critical depth cue without which the world would look pretty flat. Even so, shading is not our only depth cue. As we move around the scene, it’s hard not to see it in three dimensions. Even standing still, without moving, just knowing that we’re looking at a torus and a sphere tends to make them pop.