Shadow mapping—drawing the depth map
Now that we've seen how to perform projective texturing, we are ready to learn how to add shadows to our scene with shadow mapping. Shadow mapping is a process where we:
- Render the scene to a depth texture. This is similar to the depth texture we rendered to perform prelighting, but this time we render the scene from the light's point of view, pretending that the light we are generating shadows for is a point-target type of camera. The depth texture will store the distance from the light of the closest vertices that are in view of the light's virtual camera.
- Render the scene using the normal effects, but project the depth texture onto the scene from the light's point of view. This will allow us to extract the ...