Implementing projective shadows for directional lights
In the previous chapter, we learned how to set up a shadow mapping pipeline with OpenGL and Vulkan. Our focus was more on the API rather than on shadow correctness or versatility. In the Implementing shadow maps in OpenGL recipe of Chapter 8, Image-Based Techniques, we learned how to render shadows from spotlights using perspective projection for our shadow-casting light source. Directional light sources typically simulate sunlight, and a single light source can illuminate the entire scene. In its simplest form, this means we should construct a projection matrix which takes the bounds of the scene into account. Let's take a look at how to implement this basic approach and add some shadows to our Bistro rendering example.
Getting ready
Make sure you revisit the Implementing shadow maps in OpenGL recipe of Chapter 8, Image-Based Techniques, before you learn about the shadow mapping topic.
The calculations described...