O'Reilly logo

OpenGL® Programming Guide: The Official Guide to Learning OpenGL®, Version 4.5 with SPIR-V, Ninth Edition by Dave Shreiner, Graham Sellers, John Kessenich

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 7. Light and Shadow

Chapter Objectives

After reading this chapter, you’ll be able to do the following:

• Code a spectrum of fragment shaders to light surfaces with ambient, diffuse, and specular lighting from multiple light sources.

• Migrate lighting code between fragment and vertex shaders, based on quality and performance trade-offs.

• Use a single shader to apply a collection of lights to a variety of materials.

• Select among a variety of alternative lighting models.

• Have the objects in your scene cast shadows onto other objects.

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

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required