Game Development Reference
4. a traversal that can restart from the last node hit instead of the root using
a bit trail (intersections for secondary rays are computed faster).
1.2 Ray Tracing Rendering
The SLBVH implementation adds a new stage to the original work of [Garcia et
al. 12]. Instead of preloading a stack-based BVH from the CPU, an SLBVH is
built from scratch on each frame using the available mesh data on the GPU. The
process is the following:
1. Initialize the application on the CPU.
2. Send data to the GPU.
3. Build a SLBVH from scratch.
(a) Throw primary rays.
(b) Compute intersections.
(c) Throw secondary rays.
(d) Compute color.
5. Repeat Steps 3-4.
The coloring process includes phong shading, flat shading, texturing, normal
mapping, gloss mapping, reflections, environment mapping, and shadows. These
algorithms are common on rasterization implementations and introductory com-
puter graphics topics.
During the primary ray stage, one ray is thrown through each pixel. The
origin is located at the current camera position, and the direction is given by the
destination pixel. Each ray, either primary or secondary, travels the structure's
tree searching for the closest intersection on the camera space. The ID of the best
intersection is stored on a buffer in order to calculate the color of the current
pixel using the properties of the intersected triangle. The coloring of the pixel
takes place on the last stage.
In order to generate global illumination effects, the framework uses a Monte Carlo
approach. It generates multiple images and renders the average of all of them.
The way it presents the images is incremental. First, only one image is generated
and displayed. Then, a second image is generated, combined with the previous
one, and displayed on the screen.
This is repeated until the camera position