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 the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.