i
i
i
i
i
i
i
i
432 9. Global Illumination
y
0
0
y
-1
1
y
0
y
1
1
1
Figure 9.69. Computation of spherical harmonic coefficients for the radiance transfer
function. The object (at the top) is lit using each of the four basis functions as lighting
environments. The results are shown at the bottom. Grayscale lighting is shown—the
colors are used to show positive (green) and negative (red) values. (Images generated
using the Microsoft SDK [261] sample “PRTDemo.”)
represent how much illumination will be reflected back to the viewer, given
this lighting situation. The blue arrow going through the y
0
1
basis function
shows the resulting coefficients. The parts of the object’s surface that are
facing upward are colored bright green. This means that in those areas,
the y
0
1
coefficient has a relatively large, positive value.
Note that the directions shown in red on the spherical harmonic basis
functions are “negative.” These are treated as negative light for the lighting
computations that are carried out. While negative light does not exist in
reality, the idea to keep in mind is that we are going to represent the actual
lighting in a scene by a sum of weighted spherical harmonic elements, not by
a single element. Another way to say this is that the first SH element, the
constant sphere, can always be scaled and added to any set of negative lobes
to give a lighting description that is non-negative from every direction, in
keeping with reality. To continue with the y
0
1
transfer function coefficient,
the areas shown in black have coefficient values of 0. These areas are
equally lit by the positive and negative lobes. The locations facing toward
the bottom have negative coefficients, shown in red.
i
i
i
i
i
i
i
i
9.11. Precomputed Radiance Transfer 433
Givenfourcoecientsforeverylocationonanobject,wecanper-
fectly represent any lighting situation that is a combination of the four
SH elements shown. It can be mathematically proven that these four el-
ements can reproduce any distant lighting situation with sufficiently low
frequencies, i.e., where the radiance changes very slowly as a function of
direction. For example, if we wanted to represent a situation where in-
coming light was symmetrical around the up-down axis and mostly coming
from below, we might have the coefficients (5.2, 0, 3.0, 0). This would
represent a situation where light was coming from the direction of the neg-
ative lobe of y
0
1
,sincethe3.0coecientwouldmakethislobehavea
positive effect. The radiance would be at a maximum for light coming
in directly from below, dropping gradually to a minimum for light com-
ing directly from above. Four coefficients make for a simple example, but
are too few for most applications. Usually, more coefficients would be
used (e.g., 16 or 25) so that higher-frequency lighting situations can be
represented.
When rendering, we need the spherical harmonic coefficients for the
lighting. These are normally not provided and must be derived from the
lighting. This is done by projecting the lighting onto the spherical harmonic
basis, using the same number of basis functions as the transfer function.
See Figure 9.70. The current lighting environment is at the top. It is
projected against the four spherical harmonic basis functions, resulting in
the four numerical lighting coefficients shown by the blue arrows. Each
coefficient gives some information about the lighting situation. The y
0
0
coefficient shows how bright the lighting is on average. The y
1
1
coefficient
shows to what extent the lighting from behind the object is brighter than
that from the front. Since it is negative, we see that the lighting from the
front is slightly brighter. The y
0
1
coefficient shows that the lighting from
above is significantly brighter than from below. Finally, the y
1
1
coefficient
shows that the lighting from the right is slightly brighter than the lighting
from the left.
The final lighting is the result of a dot product between the lighting
and transfer coefficients.
14
In our example this dot product combines two
vectors, each with 4 elements, but in practice the vectors may have 25
elements or more. As shown in the center rows of Figure 9.70, a dot
product means that the precomputed transfer coefficients are multiplied
by the corresponding lighting solutions, then summed as shown by the
purple arrows. The result is the final lighting solution. Since it should
not contain any negative values (if it does, they are clamped), the result is
shown in grayscale and not using the green-red visualization.
14
Mathematically, a dot product between the spherical harmonic coefficients of two
functions is equivalent to integrating the product of the functions.
i
i
i
i
i
i
i
i
434 9. Global Illumination
y
0
0
y
-1
1
y
0
y
1
1
1
0.5
== ==
X
-0.1 0.25 0.1
XXX
+
Figure 9.70. Using the precomputed radiance transfer function for lighting. The
(grayscale) lighting environment shown at the top is projected onto the first four spheri-
cal harmonic basis functions (shown in the second row), resulting in the coefficients 0.5,
0.1, 0.25, and 0.1. The lighting at each surface location is the result of a four-element
dot product between the lighting and transfer function coefficients. The values of the
transfer function coefficients vary over the object. The lighting and transfer functions
are both grayscale, so all values are scalars. The convention of showing green for pos-
itive and red for negative values is used everywhere except in the top (source lighting)
and bottom (final shading) rows, which do not have negative values. (Images generated
using the Microsoft SDK [261] sample “PRTDemo.”)
i
i
i
i
i
i
i
i
9.11. Precomputed Radiance Transfer 435
Figure 9.71. The spherical harmonic radiance transfer function created for a single point
under the handle. The crease is due to occlusion from the handle. (Courtesy of Chris
Oat, ATI Technologies Inc.)
In this example neither the lighting nor the transfer depended on light
wavelength. In the general case, both do. The lighting coefficient for each
spherical harmonic basis function is an RGB value, not a scalar. The same
is true for the transfer coefficients. However, in many cases scalar transfer
coefficients will not introduce a noticeable visual difference, and can save
a significant amount of storage.
An alternative way to visualize the transfer function is to look at one
point and show it as a function over the sphere, similar to how BRDFs are
visualized. Such a visualization can be seen in Figure 9.71. An example of
the resulting effects can be seen in Figure 9.72.
This type of precomputed radiance transfer can model any view-
independent effect under arbitrary lighting. Lambertian lighting, self-
shadowing, interreflections, color bleeding, and subsurface scattering are
all examples of effects that can be modeled. However, only distant lighting
Figure 9.72. Three renderings of a model from the game Warhawk by Incognito Enter-
tainment. The model uses a gray Lambertian material in all three renderings. On the
left, the model is rendered with direct lighting and no shadowing. In the center, it is
rendered with ambient light and ambient occlusion. On the right, it is rendered with
precomputed radiance transfer, with a strong light from the left. (Images courtesy of
Manchor Ko.)
i
i
i
i
i
i
i
i
436 9. Global Illumination
on rigid objects is supported. Also, any high frequencies in the lighting or
transfer will be blurred.
The distant lighting restriction can be relaxed in some cases. The SH
lighting coefficients can be varied from location to location to simulate local
lighting. However, large-scale effects modeled by the transfer function may
be invalidated, especially if the lighting varies too rapidly. As a simple
example, imagine precomputed radiance transfer on a statue, which models
the shadow cast from the arm onto the body. If a light source moves
between the arm and the body, the precomputed radiance transfer will no
longer be valid. In short, local lighting can usually be modeled to good
effect if some care is taken not to let the light sources get too close to the
object.
Green [444] gives various implementation considerations for computing
and using the transfer function coefficients, as do Ko et al. [677, 678] and
Oat [950]. Isidoro [593] also gives specific considerations for using precom-
puted radiance transfer with subsurface scattering.
Techniques have been proposed to render glossy reflections with precom-
puted radiance transfer, using either spherical harmonics [633, 754, 1186]
or other bases [442, 782, 1273, 1394]. However, in practice, these techniques
are extremely costly in terms of computation, storage, or both, so they are
unlikely to be a good fit for most real-time rendering applications.
The basic diffuse precomputed radiance transfer algorithm has been
extended or improved in various ways, some of which are of interest for
real-time rendering. The storage required by the transfer function can be
quite high, including dozens of coefficients sampled over object vertices
or texels. Sloan et al. [1187] propose compressing the radiance transfer
using clustered principal components analysis. This technique speeds up
rendering, as well as saving space, but it may result in artifacts.
A later method proposed by Sloan et al. [1188] enables applying pre-
computed radiance transfer to deformable surfaces, as long as the transfer
encodes only local effects. Shadowing and interreflections from small de-
tails such as bumps can be modeled, as well as local scattering effects, such
as translucency.
Sloan [1189] also discusses different possibilities for combining radiance
transfer that has been precomputed at a low spatial resolution with fine-
scale normal maps. He investigates projecting the transferred radiance into
various bases for this purpose and concludes that the Half-Life 2 represen-
tation produces better results than low-order hemispherical or spherical
harmonics.
Precomputed radiance transfer usually refers to techniques using envi-
ronment lighting. However, some methods have been developed for precom-
puting the response of objects and surfaces to directional or point lights.
Malzbender et al. [814] present a method for encoding the directional illumi-
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset