Articles . GPU Pro 5: Object-order Ray Tracing for Dynamic Scenes
This article was published in GPU Pro 5, the fifth installment in the GPU Pro series of books. In the future, you might find minor fixes, updates or additions to the original article on this page. Get in touch if you miss anything.
Teaser / Enhanced Abstract
Ray tracing is a robust and flexible approach to image synthesis that elegantly solves many problems that are hard to solve using rasterization. Recent advances in the performance and flexibility of graphics processing hardware have made ray tracing a viable option even for real-time rendering applications. Yet, integrating ray tracing into existing rasterization-based real-time rendering solutions poses significant challenges. Modern rasterization-based rendering engines typically use the capabilities of modern GPUs to generate, transform and amplify geometry on-the-fly. In contrast, efficient ray tracing techniques typically depend upon pre-built spatial acceleration data structures that allow for fast random access to the scene geometry.
Our article presents a method for tracing incoherent secondary rays that integrates well with existing rasterization-based real-time rendering engines. In particular, it requires only linear scene access and supports fully dynamic scene geometry comprised only of triangle soups. All parts of the method that work with scene geometry are implemented in the standard graphics pipeline. Thus, the ability to generate, transform and animate geometry via shaders is fully retained. Moreover, shading can share the same material system that is used in a deferred shading rasterizer.
Consequently, our method allows for a unified rendering architecture that supports both rasterization and ray tracing. The more expensive ray tracing can easily be restricted to complex phenomena that require it, such as reflections and refractions on arbitrarily shaped scene geometry. Other rendering steps can be dealt with using rasterization as usual.
While our method of ray tracing works object-order, we still manage to limit the number of intersection tests that have to be performed: Using a coarse conservative voxel approximation of the scene, we first estimate potential hit points for each ray and subsequently only test triangles with rays that have potential hits nearby. Furthermore, we introduce a multi-pass intersection testing scheme that allows for early termination of rays on first hit (analogous to Z-culling optimizations), which is a recurring problem in methods that deviate from standard (depth-first) traversal of spatial data structures.
Our GPU Pro 5 article provides a detailed description of our ray tracing method as well as a sample implementation that demonstrates the tracing of incoherent secondary rays with reflection rays. Ray tracing is implemented in the context of a traditional rasterization-based deferred shading engine, everything besides reflection rays is rasterized as usual.
- Originally published on the official GPU Pro 5 Blog