Spot light PCF shadows

Out of all the different light sources we covered, adding shadow-casting support to spot lights is the easiest to accomplish. We will be using a technique based on the way projected textures are handled (covered in Chapter 1, Forward Lighting). This shadow-casting technique is called percentage-closer filtering (PCF).

The following screenshot features a side-by-side view of the same spot light with no shadows on the left-hand side and with shadows on the right-hand side:

Spot light PCF shadows

One side benefit of shadows is that they help clarify the relative height between different scene elements. In the left image of the screenshot, it's hard to ...

Get HLSL Development Cookbook now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.