Chapter 13. Shadows

 

I have a little shadow that goes in and out with me And what can be the use of him is more than I can see.

 
 --From My Shadow by Robert Louis Stevenson

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 ...

Get OpenGL® Shading Language, Second Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.