O'Reilly logo

GPU PRO 3 by Wolfgang Engel

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

1
III
Ray-Traced Approximate
Reflections Using a Grid of
Oriented Splats
Holger Gruen
1.1 Overview
This chapter introduces a method to generate approximate ray-traced reflections
of dynamic scene elements. It uses a dynamic 3D grid containing lists of oriented
surface splats to generate these reflections on DX11-class GPUs. It is shown how a
straightforward implementation of this technique allows for real-time frame rates
for low to moderate grid sizes. The resulting reflections are plausible for rough
reflectors. The chapter further describes a future implementation that utilizes a
flat hierarchical grid to improve the quality of the reflections while keeping the
memory requirements for the 3D grid at an acceptable level.
1.2 Introduction
Real-time reflections in dynamic scenes are still one of the most desired features
for real-time 3D applications like computer games, and they pose a really chal-
lenging problem in the general case. Recent advances in programmable hardware
allow real-time rendering into data structures that capture properties of dynamic
scene elements (see e.g., [Yang et al. 10]). This chapter makes use of these ca-
pabilities to construct a data structure that allows for computing approximate
reflections of dynamic scene elements.
Until now, real-time reflections have been realized by one or a combination of
the following techniques:
1. Flat Reflectors. Mirror the camera to render a reflection texture.
181
182 III Global Illumination Effects
2. Reflections through a set of environment maps. An approximation of the
real reflections seen at a specific surface point in the scene is generated.
Usually environment maps are used to realize reflections of distant objects.
3. Screen space reflections. An approximation is generated that ignores reflec-
tions from objects that are not visible onscreen.
4. Image-based reflections. Examples are the billboard reflections in the last
Unreal Engine 3 demo presented at GDC 2011.
The DX11 rasterizer is used to generate a splat-based intermediate represen-
tation of the dynamic objects’ surfaces in a scene. In the context of this chapter,
the minimum set of attributes stored for each splat are the 3D position of the
center of the splat, a surface normal, and some other surface properties used for
lighting. This approach shares some of the benefits of image-based rendering, as
there is no longer a need to access the full scene geometry. The rasterizer also
eliminates some of the geometric complexity of the scene, as small triangles that
do not straddle the center of a pixel will not generate any splats.
The use of the rasterizer makes it possible to render exactly the same geometry
that is used by other rendering passes of the 3D application. As a result, no
memory for an additional scene representation is needed.
GPU-based ray tracing of the full-scene geometry can also be used to generate
high-quality reflections. However, ray tracing of fully dynamic scenes is not yet
fast enough for a real-time solution. Also, ray-tracing algorithms can become
memory limited if they need to parse the full geometric complexity of the scene.
This can be especially bad for nonplanar reflectors, as reflected rays in general
do not show good coherence.
1.3 The Basic Algorithm
The basic algorithm for generating approximate splat-based reflections works in
three phases. These will be now described in detail. Please note that all phases
must be carried out per frame for all dynamic scene elements.
1.3.1 Phase 1: Generating a Grid of Splats
In order to generate a good set of point splats, one renders a set of orthogonal
views of the geometry in question. Typically three views, for example, a top view,
a front view, and a side view are used. To render these views efficiently, we use
hardware instancing to replicate the geometry for each of the views . The DX11
system value SV_InstanceID is used inside the vertex shader to select what view
matrix and what orthogonal projection matrix are to be used.
DX11-class graphics hardware allows for scattering pixel shaders. In other
words, a pixel shader can write data to an arbitrary location inside a buffer.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required