GPU Ray Tracing by Steven G

GPU Ray Tracing by Steven G

DOI:10.1145/2447976.2447997 GPU Ray Tracing By Steven G. Parker, Heiko Friedrich, David Luebke, Keith Morley, James Bigler, Jared Hoberock, David McAllister, Austin Robison, Andreas Dietrich, Greg Humphreys, Morgan McGuire, and Martin Stich Abstract acceleration structure creation and traversal, on-the-fly The NVIDIA® OptiX™ ray tracing engine is a programmable scene update, and a dynamically load-balanced GPU execu- system designed for NVIDIA GPUs and other highly par- tion model. Although OptiX primarily targets highly parallel allel architectures. The OptiX engine builds on the key GPU architectures, it is applicable to a wide range of special- observation that most ray tracing algorithms can be imple- and general-purpose hardware, including modern CPUs. mented using a small set of programmable operations. Consequently, the core of OptiX is a domain-specific just- 1.1. Ray tracing, rasterization, and GPUs in-time compiler that generates custom ray tracing kernels Computer graphics algorithms for rendering, or image by combining user-supplied programs for ray generation, synthesis, take one of two complementary approaches. One material shading, object intersection, and scene traversal. family of algorithms loop over the pixels in the image, com- This enables the implementation of a highly diverse set of puting for each pixel, the first object visible at that pixel; this ray tracing-based algorithms and applications, including approach is called ray tracing because it solves the geometric interactive rendering, offline rendering, collision detection problem of intersecting a ray from the pixel into the objects. systems, artificial intelligence queries, and scientific simula- A second family of algorithms loops over the objects in the tions such as sound propagation. OptiX achieves high perfor- scene, computing for each object the pixels covered by that mance through a compact object model and application of object. Because the resulting per-object pixels (called frag- several ray tracing-specific compiler optimizations. For ease ments) are formatted for a raster display, this approach is of use it exposes a single-ray programming model with full called rasterization. The central data structure of ray trac- support for recursion and a dynamic dispatch mechanism ing is a spatial index called an acceleration structure, used to similar to virtual function calls. avoid testing each ray against all objects. The central data structure of rasterization is the depth buffer, which stores the distance of the closest object seen at each pixel and discards 1. INTRODUCTION fragments from invisible objects. While both approaches Many CS undergraduates have taken a computer graphics have been generalized and optimized greatly beyond this course where they wrote a simple ray tracer. With a few simplistic description, the basic distinction remains: ray simple concepts on the physics of light transport, students tracing iterates over rays while rasterization iterates over can achieve high quality images with reflections, refraction, objects. High-performance ray tracing and rasterization, shadows, and camera effects such as depth of field—all of both focus on rendering the simplest of objects: triangles. which present challenges on contemporary real-time graph- Historically, ray tracing has been considered slow and ics pipelines. Unfortunately, the computational burden of rasterization fast. The simple, regular structure of depth- ray tracing makes it impractical in many settings, especially buffer rasterization lends itself to highly parallel hardware where interactivity is important. Researchers have invented implementations: each object moves through several stages many techniques for improving the performance of ray trac- of computation (the so-called graphics pipeline), with each ing,13 especially when mapped to high-performance archi- stage performing similar computations in data-parallel tectural features such as explicit SIMD instructions12 and fashion on the many objects, fragments, and pixels in flight Single-Instruction Multiple-Thread (SIMT)-based6 GPUs.1 throughout the pipeline. As graphics hardware has grown Unfortunately most such techniques muddy the simplicity more parallel it has also grown more general, evolving from and conceptual purity that make ray tracing attractive. Nor specialized fixed-function circuitry implementing the vari- have industry standards emerged to hide these complexi- ous stages of the graphics pipeline into fully programmable ties, as Direct3D and OpenGL do for rasterization. processors that virtualize those stages onto hundreds or even To address these problems, we introduce OptiX, a general thousands of small general-purpose cores. Today’s graphics purpose ray tracing engine. A general programming inter- processing units, or GPUs, are massively parallel processors face enables the implementation of a variety of ray tracing- capable of performing trillions of floating-point math oper- based algorithms in graphics and non-graphics domains, ations and rendering billions of triangles each second. The such as rendering, sound propagation, collision detection, computational horsepower and power efficiency of mod- and artificial intelligence. This interface is conceptually ern GPUs has made them attractive for high-performance simple yet enables high performance on modern GPU archi- tectures and is competitive with hand-coded approaches. The original version of this paper is entitled “OptiX: A General In this paper, we discuss the design goals of the OptiX Purpose Ray Tracing Engine” and was published in ACM engine as well as an implementation for NVIDIA GPUs. In Transactions on Graphics (TOG)—Proceedings of ACM our implementation, we compose domain-specific compi- SIGGRAPH, July 2010, ACM lation with a flexible set of controls over scene hierarchy, MAY 2013 | VOL. 56 | NO. 05 | COMMUNICATIONS OF THE ACM 93 research highlights computing, from many of the fastest supercomputers in that can be customized to implement a wide variety of ray the world to science, math, and engineering codes on the tracing-based algorithms.9 These user-provided operations, desktop. All of which raises the question: can ray tracing be which we simply call programs, can be combined with a user- implemented efficiently and flexibly on GPUs? defined data structure (payload) associated with each ray. The ensemble of programs together implement a particular 1.2. Contributions and design goals client application’s algorithm. To create a high-performance system for a broad range of ray tracing tasks, several trade-offs and design decisions led to 3.1 Programs the following contributions: OptiX includes seven different types of these programs, each of which conceptually operates on a single ray at a • A general, low level ray tracing engine. OptiX is not a time. In addition, a bounding box program operates on renderer. It focuses exclusively on the fundamental geometry to determine primitive bounds for acceleration computations required for ray tracing and avoids structure construction. The combination of user programs embedding, rendering-specific constructs such as and hardcoded OptiX kernel code forms the ray tracing lights, shadows, and reflectance. pipeline, which is outlined in Figure 2. Unlike a feed-forward • A programmable ray tracing pipeline. OptiX shows that rasterization pipeline, it is more natural to think of the ray most ray tracing algorithms can be implemented using tracing pipeline as a call graph. The core operation, rtTrace, a small set of lightweight programmable operations. alternates between locating an intersection (Traverse) and It defines an abstract ray tracing execution model as a responding to that intersection (Shade). By reading and sequence of user-specified programs, analogous to the writing data in user-defined ray payloads and in global device- traditional rasterization-based graphics pipeline. memory arrays called buffers, these operations are combined • A simple programming model. OptiX avoids burdening to perform arbitrary computation during ray tracing. the user with the machinery of high-performance ray Ray generation programs are the entry into the ray tracing tracing algorithms. It exposes a familiar recursive, pipeline. A single invocation of rtContextLaunch from the host single-ray programming model rather than ray packets will create many instantiations of these programs. A typical ray or explicit vector constructs, and abstracts any batch- generation program will create a ray using a camera model for ing or reordering of rays. a single sample within a pixel, start a trace operation, and store • A domain-specific compiler. The OptiX engine combines the resulting color in an output buffer. But by distinguishing just-in-time compilation techniques with ray tracing- ray generation from pixels in an image, OptiX enables other specific knowledge to implement its programming operations such as creating photon maps, precomputing model efficiently. The engine abstraction permits the lighting texture maps (also known as baking), processing ray compiler to tune the execution model for available requests passed from OpenGL, shooting multiple rays for system hardware. super-sampling, or implementing different camera models. Intersection programs implement ray-geometry intersec- 2. RELATED WORK tion tests. As the acceleration structures are traversed, the While numerous high-level ray tracing libraries, engines, system will invoke intersection programs to perform geo- and APIs have been proposed,13 efforts to date have been

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    9 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us