182 III Global Illumination Eﬀects
2. Reﬂections through a set of environment maps. An approximation of the
real reﬂections seen at a speciﬁc surface point in the scene is generated.
Usually environment maps are used to realize reﬂections of distant objects.
3. Screen space reﬂections. An approximation is generated that ignores reﬂec-
tions from objects that are not visible onscreen.
4. Image-based reﬂections. Examples are the billboard reﬂections 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 beneﬁts 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 reﬂections. 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 reﬂectors, as reﬂected rays in general
do not show good coherence.
1.3 The Basic Algorithm
The basic algorithm for generating approximate splat-based reﬂections 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 eﬃciently, 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 buﬀer.