Summary
In this chapter, we have presented two implementations for ray-traced shadows. In the first section, we provided a simple implementation similar to what you might find in an offline renderer. We simply shoot one ray per fragment to each light to determine whether it’s visible or not from that position.
While this works well for point lights, it would require many rays to support other light types and render soft shadows. For this reason, we also provided an alternative that makes use of spatial and temporal information to determine how many samples to use per light.
We start by computing the visibility variance of the past four frames. We then filter this value to determine how many rays to shoot for each fragment for each light. We use this count to traverse the scene and determine the visibility
value for each fragment. Finally, we filter the visibility we obtained to reduce the noise. The filtered visibility is then used in the lighting computation to determine...