Chapter 12. Lighting

In the real world, we see things because they reflect light from a light source or because they are light sources themselves. In computer graphics, just as in real life, we won’t be able to see an object unless it is illuminated or emits light. To generate more realistic images, we need to have more realistic models for illumination, shadows, and reflection than those we’ve discussed so far.

In this chapter and the next two, we explore how the OpenGL Shading Language can help us implement such models so that they can execute at interactive rates on programmable graphics hardware. In this chapter, we look at some lighting models that provide more flexibility and give more realistic results than those built into OpenGL’s fixed ...

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.