Before finishing this chapter, let's revisit the topic of lights. So far, for the purpose of our examples, we’ve assumed that our light source is infinitely far away from the scene. This assumption allows us to model the light rays as being parallel to each other. An example of this is sunlight. These lights are directional lights. Now, we are going to consider a case where the light source is relatively close to the object it needs to illuminate. Think, for example, of a desk lamp illuminating the document you’re reading. These lights are positional lights:
As we experienced before, when working with directional lights, only one variable is required. This is the light direction we represented in the uLightDirection uniform.
In contrast, when working with positional lights, we need to know the location of the light. We can...