Chapter 13. Shadows
Like Robert Louis Stevenson, have you ever wondered what shadows are good for? The previous chapter discussed lighting models, and wherever there is light, there are also shadows. Well, maybe this is true in the real world, but it is not always true in computer graphics. We have talked a lot about illumination already and have developed a variety of shaders that simulate light sources. But so far we have not described any shaders that generate shadows. This lack of shadows is part of the classic computer graphics "look" and is one obvious clue that a scene is synthetic rather than real.
What are shadows good for? Shadows help define the spatial relationships between objects in a scene. Shadows tell us when a character's feet make contact with the floor as he is running. The shape and movement of a bouncing ball's shadow gives us a great deal of information about the ball's location at any point in time. Shadows on objects help reveal shape and form. In film and theater, shadows play a vital role in establishing mood. And in computer graphics, shadows help enhance the apparent realism of the scene.
Although computing shadows adds complexity and slows performance, the increase in comprehension and realism is often worth it. In this chapter, we explore some relatively simple techniques that produce shadows and shadow effects.