Ray tracing provides developers with an organic, photoreal solution to crafting reflections, refractions, and shadows. These elements are the focus of the third FREE installment of Ray Tracing Gems, which can be downloaded at NVIDIA Developer Zone.
“Any ray traced rendering leads to several design decisions about what effects are supported and how they are supported. Ray tracing’s main historical appeal is that it handles shadows, reflections, and refractions well. However, when you sit down and actually implement a system that supports these effects, you run into several non-obvious design decisions. This part of the book describes several specific approaches to some of these.
“Though ray tracing a clear glass ball is straightforward, more complex models throw a wrench in the works. For example, a simple glass of water presents three distinct types of material interface behaviors: water/air, glass/air, and glass/water. To get the refraction right, a ray/surface interaction needs to know not only which interface is hit but also what material is on what side of the ray. It is problematic to expect an artist to build a model out of these interfaces; imagine filling a glass with water. A clever and battle-tested approach to dealing with the issue is described in Chapter 11, ‘Automatic Handling of Materials in Nested Volumes.’
“An issue that has plagued almost all ray tracing programs is what to do when a bump map produces physically impossible surface normal vectors. The obvious “hard if” code solution to ignore these can cause jarring color discontinuities. Every ray tracer has its own home-grown hack to deal with this. In Chapter 12, ‘A Microfacet-Based Shadowing Function to Solve the Bump Terminator Problem,’ a simple statistical approach with a clean implementation is presented.
“Ray tracing’s screen-space approach has made it particularly strong at generating screen-accurate shadows without all the aliasing problems associated with shadow maps. However, can ray tracing be made fast enough to be interactive? Chapter 13, ‘Ray Traced Shadows: Maintaining Real-Time Frame Rates,’ provides a detailed explanation of how this can be done.
“Most simple ray tracers send rays from the eye. Typically these programs can- not practically generate caustics, the focused light patterns that we associate with glasses of liquid, swimming pools, and lakes. The “practically” is because the results are too noisy. However, sending rays from the light into the environment is a workable approach to generate caustics. In fact, this can even be done in real time, as described in Chapter 14, ‘Ray-Guided Volumetric Water Caustics in Single Scattering Media with DXR.’
“In summary, a basic ray tracer is fairly straightforward. Deploying a production ray tracer requires some careful handling of basic effects, and this part provides several useful approaches for doing just that.”
DOWNLOAD RAY TRACING GEMS PARTS I, II, and III HERE: NVIDIA Developer Zone.