Revisiting Shadows with Ray Tracing
In this chapter, we are going to implement shadows using ray tracing. In Chapter 8, Adding Shadows Using Mesh Shaders, we used traditional shadow mapping techniques to get the visibility from each light and use that information to compute the shadow term for the final image. Using ray tracing for shadows allows us to get more detailed results and to have finer-grained control over the quality of results based on the distance and intensity of each light.
We are going to implement two techniques: the first one is similar to the one used in offline rendering, where we shoot rays to each light to determine visibility. While this approach gives us the best results, it can be quite expensive depending on the number of lights in the scene.
The second technique is based on a recent article from Ray Tracing Gems. We use some heuristics to determine how many rays we need to cast per light, and we combine the results with spatial and temporal filters...