i
i
i
i
i
i
i
i
Chapter 9
Global Illumination
“If it looks like computer graphics,
it is not good computer graphics.”
—Jeremy Birn
Radiance is the final quantity computed by the rendering process. So
far, we have been using the reflectance equation to compute it:
L
o
(p, v)=
Ω
f(l, v) ⊗L
i
(p, l)cosθ
i
dω
i
, (9.1)
where L
o
(p, v) is the outgoing radiance from the surface location p in the
view direction v; Ω is the hemisphere of directions above p; f(l, v)isthe
BRDF evaluated for v and the current incoming direction l; L
i
(p, l)isthe
incoming radiance into p from l; ⊗ is the piecewise vector multiplication
operator (used because both f (l, v)andL
i
(p, l) vary with wavelength, so
are represented as RGB vectors); and θ
i
is the angle between l and the
surface normal n. The integration is over all possible l in Ω.
The reflectance equation is a restricted special case of the full rendering
equation, presented by Kajiya in 1986 [619]. Different forms have been used
for the rendering equation. We will use the following one:
L
o
(p, v)=L
e
(p, v)+
Ω
f(l, v) ⊗ L
o
(r(p, l), −l)cosθ
i
dω
i
, (9.2)
where the new elements are L
e
(p, v) (the emitted radiance from the surface
location p in direction v), and the following replacement:
L
i
(p, l)=L
o
(r(p, l), −l). (9.3)
This replacement means that the incoming radiance into location p from
direction l is equal to the outgoing radiance from some other point in the
opposite direction −l. In this case, the “other point” is defined by the
ray casting function r(p, l). This function returns the location of the first
surface point hit by a ray cast from p in direction l (see Figure 9.1).
327
i
i
i
i
i
i
i
i
328 9. Global Illumination
L
i
(p,l)
L
o
(r(p,l),-l)
r(p,l)
p
l
-l
Figure 9.1. The shaded surface location p, lighting direction l, ray casting function
r(p, l), and incoming radiance L
i
(p, l), also represented as L
o
(r(p, l), −l).
The meaning of the rendering equation is straightforward. To shade
a surface location p, we need to know the outgoing radiance L
o
leaving
p in the view direction v. This is equal to the emitted radiance L
e
plus
the reflected radiance. Emission from light sources has been studied in
previous chapters, as has reflectance. Even the ray casting operator is not
as unfamiliar as it may seem. The Z-buffer computes it for rays cast from
the eye into the scene.
The only new term is L
o
(r(p, l), −l), which makes explicit the fact
that the incoming radiance into one point must be outgoing from an-
other point. Unfortunately, this is a recursive term. That is, it is com-
puted by yet another summation over outgoing radiance from locations
r(r(p, l), l
). These in turn need to compute the outgoing radiance from
locations r(r(r(p, l), l
), l
), ad infinitum (and it is amazing that the real
world can compute all this in real-time).
We know this intuitively, that lights illuminate a scene, and the photons
bounce around and at each collision are absorbed, reflected, and refracted
in a variety of ways. The rendering equation is significant in that it sums
up all possible paths in a simple (looking) equation.
In real-time rendering, using just a local lighting model is the default.
That is, only the surface data at the visible point is needed to compute
the lighting. This is a strength of the GPU pipeline, that primitives can
be generated, processed, and then be discarded. Transparency, reflections,
and shadows are examples of global illumination algorithms, in that they
use information from other objects than the one being illuminated. These
effects contribute greatly to increasing the realism in a rendered image, and
also provide cues that help the viewer to understand spatial relationships.
One way to think of the problem of illumination is by the paths the
photons take. In the local lighting model, photons travel from the light
to a surface (ignoring intervening objects), then to the eye. Shadowing
techniques take into account these intervening objects’ direct effects. With
environment mapping, illumination travels from light sources to distant ob-
jects, then to local shiny objects, which mirror-reflect this light to the eye.
Irradiance maps simulate the photons again, which first travel to distant
Get Real-Time Rendering, Third Edition, 3rd Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.