i
i
i
i
i
i
i
i
2 4
2 4
Global Illumination
Many surfaces in the real world receive most or all of their incident light from
other reective surfaces. This is often called indirect lighting or mutual illumi-
nation. For example, the ceilings of most rooms receive little or no illumination
directly from luminaires (light emitting objects). The direct and indirect compo-
nents of illumination are shown in Figure 24.1.
Although accounting for the interreection of light between surfaces is
straightforward, it is potentially costly because all surfaces may reect any given
surface, resulting in as many as O(N
2
) interactions for N surfaces. Because the
entire global database of objects may illuminate any given object, accounting for
indirect illumination is often called the global illumination problem.
There is a rich and complex literature on solving the global illumination prob-
lem (e.g., (Appel, 1968; Goral et al., 1984; Cook et al., 1984; Immel et al., 1986;
Figure 24.1. In the left and middle images, the indirect and direct lighting, respectively,
are separated out. On the right, the sum of both components is shown. Global illumination
algorithms account for both the direct and the indirect lighting.
623
i
i
i
i
i
i
i
i
624 24. Global Illumination
Kajiya, 1986; Malley, 1988)). In this chapter we discuss two algorithms as exam-
ples: particle tracing and path tracing. The rst is useful for walkthrough appli-
cations such as maze games, and as a component of batch rendering. The second
is useful for realistic batch rendering. Then we discuss separating out “direct”
lighting where light takes exactly once bounce between luminaire and camera.
24.1 Particle Tracing for Lambertian Scenes
Recall the transport equation from Section 20.2:
L
s
(k
o
)=
all k
i
ρ(k
i
, k
o
)L
f
(k
i
)cosθ
i
i
.
The geometry for this equation is shown Figure 24.2. When the illuminated point
is Lambertian, this equation reduces to:
L
s
=
R
π
all k
i
L
f
(k
i
)cosθ
i
i
,
where R is the diffuse reectance. One way to approximate the solution to this
equation is to use nite element methods. First, we break the scene into N sur-
faces each with unknown surface radiance L
i
,reectance R
i
, and emitted radi-
ance E
i
. This results in the set of N simultaneous linear equations
L
i
= E
i
+
R
i
π
N
j=1
k
ij
L
j
,
where k
ij
is a constant related to the original integral representation. We then
solve this set of linear equations, and we can render N constant-colored polygons.
This nite element approach is often called radiosity.
Figure 24.2. The geometry for the transport equation in its directional form.
i
i
i
i
i
i
i
i
24.1. Particle Tracing for Lambertian Scenes 625
An alternative method to radiosity is to use a statistical simulation approach by
randomly following light “particles” from the luminaire though the environment.
This is a type of particle tracing. There are many algorithms that use some form
of particle tracing; we will discuss a form of particle tracing that deposits light
in the textures on triangles. First, we review some basic radiometric relations.
The radiance L of a Lambertian surface with area A is directly proportional to the
incident power per unit area:
L =
Φ
πA
, (24.1)
where Φ is the outgoing power from the surface. Note that in this discussion, all
radiometric quantities are either spectral or RGB depending on the implementa-
tion. If the surface has emitted power Φ
e
, incident power Φ
i
,andreectance R,
then this equation becomes
L =
Φ
e
+ RΦ
i
πA
.
If we are given a model with Φ
e
and R specied for each triangle, we can proceed
luminaire by luminaire, ring power in the form of particles from each luminaire.
We associate a texture map with each triangle to store accumulated radiance, with
all texels initialized to
L =
Φ
e
πA
.
If a given triangle has area A and n
t
texels, and it is hit by a particle carrying
power φ, then the radiance of that texel is incremented by
ΔL =
n
t
φ
πA
.
Once a particle hits a surface, we increment the radiance of the texel it hits, prob-
abilistically decide whether to reect the particle, and if we reect it we choose a
direction and adjust its power.
Note that we want the particle to terminate at some point. For each surface we
can assign a reection probability p to each surface interaction. A natural choice
would be to let p = R as it is with light in nature. The particle would then scatter
around the environment not losing or gaining any energy until it is absorbed.
This approach works well when the particles carry a single wavelength (Walter et
al., 1997). However, when a spectrum or RGB triple is carried by the ray as is
often implemented (Jensen, 2001), there is no single R and some compromise for
the value of p should be chosen. The power φ
for reected particles should be
adjusted to account for the possible extinction of the particles:
φ
=
p
i
i
i
i
i
i
i
i
626 24. Global Illumination
Figure 24.3. The path of a particle that survives with probability 0.5 and is absorbed at the
last intersection. The RGB power is shown for each path segment.
Note that p can be set to any positive constant less than one, and that this constant
can be different for each interaction. When p>Rfor a given wavelength, the
particle will gain power at that wavelength, and when p<Rit will lose power
at that wavelength. The case where it gains power will not interfere with conver-
gence because the particle will stop scattering and be terminated at some point as
long as p<1. For the remainder of this discussion we set p =0.5. The path of a
single particle in such a system is shown in Figure 24.3.
A key part to this algorithm is that we scatter the light with an appropriate
distribution for Lambertian surfaces. As discussed in Section 14.4.1, we can nd
a vector with a cosine (Lambertian) distribution by transforming two canonical
random numbers (ξ
1
2
) as follows:
a =
cos (2πξ
1
)
ξ
2
, sin (2πξ
1
)
ξ
2
,
1 ξ
2
. (24.2)
Note that this assumes the normal vector is parallel to the z-axis. For a triangle,
we must establish an orthonormal basis with w parallel to the normal vector. We
can accomplish this as follows:
w =
n
n
,
u =
p
1
p
0
p
1
p
0
,
v = w × u ,
i
i
i
i
i
i
i
i
24.2. Path Tracing 627
where p
i
are the vertices of the triangle. Then, by denition, our vector in the
appropriate coordinates is
a =cos(2πξ
1
)
ξ
2
u +sin(2πξ
1
)
ξ
2
v +
1 ξ
2
w. (24.3)
In pseudocode our algorithm for p =0.5 and one luminaire is:
for (Each of n particles) do
RGB phi /n
compute uniform random point a on luminaire
compute random direction b with cosine density
done = false
while not done do
if (ray a + tb hits at some point c ) then
add n
t
Rφ/(πA) to appropriate texel
if (ξ
1
> 0.5) then
φ =2
a = c
b = random direction with cosine density
else
done = true
Here ξ
i
are canonical random numbers. Once this code has run, the texture maps
store the radiance of each triangle and can be rendered directly for any viewpoint
with no additional computation.
24.2 Path Tracing
While particle tracing is well suited to precomputation of the radiances of diffuse
scenes, it is problematic for creating images of scenes with general BRDFs or
scenes that contain many objects. The most straightforward way to create images
of such scenes is to use path tracing (Kajiya, 1986). This is a probabilistic method
that sends rays from the eye and traces them back to the light. Often path tracing
is used only to compute the indirect lighting. Here we will present it in a way
that captures all lighting, which can be inefcient. This is sometimes called brute
force path tracing. In Section 24.3, more efcient techniques for direct lighting
can be added.
In path tracing, we start with the full transport equation:
L
s
(k
o
)=L
e
(k
o
)+
all k
i
ρ(k
i
, k
o
)L
f
(k
i
)cosθ
i
i
.
..................Content has been hidden....................

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