i
i
i
i
i
i
i
i
7.4. Light Source Types 221
Figure 7.13. Some types of lights: directional, omni with no falloff, and spotlight with a
smooth transition.
the spotlight’s exponent property, s
exp
. An abrupt cutoff can be specified
by setting the cutoff angle θ
u
to be less than 90
(this equation does not
allow for values of θ
u
greater than 90
).
6
We call θ
u
the umbra angle,the
angle at which the intensity reaches 0. The value cos θ
s
is computed as
s ·−l. Note that unlike most cosines in this chapter, all the cosine factors
used in the spotlight equations happen to be unclamped (so cosine is used
rather than
cos).
The exponent and cutoff behavior in the DirectX fixed-function pipeline
is more flexible:
I
L
(l)=
I
L
max
, where cos θ
s
cos θ
p
,
I
L
max
cos θ
s
cos θ
u
cos θ
p
cos θ
u
s
exp
, where cos θ
u
< cos θ
s
< cos θ
p
,
0, where cos θ
s
cos θ
u
.
(7.18)
The angle θ
p
defines the penumbra angle of the spotlight, or the angle at
which its intensity starts to decrease. The idea is to create three zones:
an inner cone, where the light’s intensity is constant; between inner and
outer cones, where the intensity drops off in some fashion; and beyond the
outer cone, where the light has no effect. Unlike the spotlight function in
Equation 7.17, this function allows for umbra and penumbra angles up to
180
,aslongasθ
p
θ
u
. Figure 7.13 shows some light types.
Other spotlight functions can of course be used. For example, the func-
tion between the inner and outer cones could be an S-curve, so providing
continuity between the two cones. Functions can also vary with radial an-
gle, and can vary over time, e.g., to produce a flickering torch. Real-world
lights have more complex curves describing their behavior. An interest-
ing description of a system that measures intensity distributions from real
light sources and applies them to rendering can be found in Verbeck and
Greenberg’s article [1301].
6
The OpenGL fixed-function pipeline does allow θ
u
= 180
as a special value that
disables spotlight functionality completely.
i
i
i
i
i
i
i
i
222 7. Advanced Shading
Figure 7.14. Projective textured light. The texture is projected onto the teapot and
ground plane and used to modulate the light’s contribution within the projection frustum
(it is set to 0 outside the frustum). (Image courtesy of NVIDIA Corporation.)
7.4.3 Textured Lights
Textures can be used to add visual richness to light sources and allow
for complex intensity distribution or spotlight functions. For lights that
have all their illumination limited to a cone or frustum, projective textures
can be used to modulate the light intensity [849, 1146, 1377]. This allows
for shaped spotlights, patterned lights, and even “slide projector” effects
(Figure 7.14). These lights are often called gobo or cookie lights, after the
terms for the cutouts used in professional theater and film lighting. See
Section 9.1.2 for a discussion of projective mapping being used in a similar
way to cast shadows.
For lights that are not limited to a frustum but illuminate in all di-
rections, a cube map can be used to modulate the intensity, instead of
a two-dimensional projective texture. One-dimensional textures can be
used to define arbitrary distance falloff functions. Combined with a two-
dimensional angular attenuation map, this can allow for complex volu-
metric lighting patterns [256]. A more general possibility is to use three-
dimensional (volume) textures to control the light’s falloff [256, 401, 849].
This allows for arbitrary volumes of effect, including light beams. This
technique is memory intensive (as are all volume textures). If the light’s
volume of effect is symmetrical along the three axes, the memory footprint
can be reduced eightfold by mirroring the data into each octant.
Textures can be added to any light type to enable additional visual
effects. Textured lights allow for easy control of the illumination by artists,
who can simply edit the texture used.
i
i
i
i
i
i
i
i
7.5. BRDF Theory 223
7.4.4 Other Light Sources
Many other lighting options are possible. As long as the shader has l and
E
L
values for use in evaluating the shading equation, any method can be
used to compute those values. An interesting example of a powerful and
flexible light source model used in film rendering is given by Barzel [70].
This light source (called an uberlight) is perhaps a bit too costly for most
real-time applications, but it shows the variety of useful effects that can
be achieved. Pellacini and Vidimˇce [995] discuss GPU implementations of
Barzel’s uberlight, as well as other lighting effects.
7.5 BRDF Theory
Section 5.5 described a shading equation for simulating the interaction of
light with a surface. This equation is just one of many possible shading
equations that can be used. In this section we will explain the theory
behind such equations, go over some of the more interesting possibilities,
and finally discuss implementation issues.
7.5.1 The BRDF
When shading a surface, the outgoing radiance in a given direction is com-
puted, given quantities and directions of incoming light. In radiometry, the
function that is used to describe how a surface reflects light is called the
bidirectional reflectance distribution function (BRDF) [932]. As its name
implies, it is a function that describes how light is reflected from a sur-
face given two directions—the incoming light direction l and outgoing view
direction v.
The precise definition of the BRDF is the ratio between differential
outgoing radiance and differential irradiance:
f(l, v)=
dL
o
(v)
dE(l)
. (7.19)
To understand what this means, imagine that a surface is illuminated by
light incoming from a tiny solid angle (set of directions) around l.This
illumination is measured at the surface as irradiance dE. The surface then
reflects this light in various directions. In any given outgoing direction v,
the radiance dL
o
is proportional to the irradiance dE. The ratio between
the two, which depends on l and v, is the BRDF. The value of the BRDF
depends also on wavelength, so for rendering purposes it is represented as
an RGB vector.
The discussion in this chapter is restricted to shading with non-area
light sources such as point or directional lights. In this case, the BRDF
i
i
i
i
i
i
i
i
224 7. Advanced Shading
definition can be expressed in a non-differential form:
f(l, v)=
L
o
(v)
E
L
cos θ
i
, (7.20)
where E
L
is the irradiance of a light source measured in a plane perpen-
dicular to the light direction vector l,andL
o
(v) is the resulting outgoing
radiance in the direction of the view vector v. The clamped cosine of the
angle θ
i
between l and the surface normal n converts E
L
to irradiance mea-
sured at the surface. It is now straightforward to see how the BRDF fits
into a general shading equation with n non-area lights:
L
o
(v)=
n
k=1
f(l
k
, v) E
L
k
cos θ
i
k
, (7.21)
where k is the index for each light.
The symbol (piecewise vector multiply) is used, since both the BRDF
and irradiance are RGB vectors. Since the incoming and outgoing direc-
tions each have two degrees of freedom (a common parameterization is to
use two angles: elevation θ relative to the surface normal and rotation
φ about the normal), the BRDF is a function of four scalar variables in
the general case. Isotropic BRDFS are an important special case. Such
BRDFs remain the same when the incoming and outgoing direction are ro-
tated around the surface normal (keeping the same relative angles between
them). Isotropic BRDFs are functions of three scalar variables. Figure 7.15
showsthevariablesusedinbothcases.
The BRDF is defined as radiance (power/(area × solid angle)) di-
vided by irradiance (power/area), so its units are inverse solid angle, or
steradians
1
. Intuitively, the BRDF value is the relative amount of energy
reflected in the outgoing direction, given the incoming direction.
v
n
l
t
Figure 7.15. The BRDF. Azimuth angles φ
i
and φ
o
are given with respect to a given
tangent vector t. The relative azimuth angle φ (used for isotropic BRDFs instead of φ
i
and φ
o
) does not require a reference tangent vector.
i
i
i
i
i
i
i
i
7.5. BRDF Theory 225
Figure 7.16. Light interacting with a surface. On the left, we see the subsurface interac-
tions causing light to be re-emitted away from the entry point. The red and green circles
represent the region covered by a pixel at two different scales of observation. On the
right, all subsurface scattered light is shown emitting from the entry point—the details
of what happens under the surface are ignored.
The BRDF abstracts how light interacts with an object. Section 5.3
discussed the various phenomena that occur: Some light is scattered into
the surface (refraction or transmission), and some light is scattered away
(reflection). In addition, the light transmitted into the object may undergo
absorption and additional scattering, eventually causing some of it to exit
the surface—a phenomena called subsurface scattering. The left side of
Figure 7.16 shows these various types of light-matter interactions.
Figure 7.16 also contains two colored circles that show the areas cov-
ered by a pixel in two cases. The red circle represents a case where the
area covered by a pixel is small compared to the distance between the
entry and exit locations of the subsurface scattered light. In this case, a
BRDF cannot be used to describe the subsurface scattering; instead a more
general equation must be used. This equation is the bidirectional surface
scattering reflectance distribution function (BSSRDF) [932]. The general
BSSRDF encompasses large-scale subsurface scattering by adding incoming
and outgoing locations as inputs to the function. The BSSRDF describes
the relative amount of light that travels along the incoming direction, then
from one point to the other of the surface, then along the outgoing direc-
tion. Techniques for rendering objects that exhibit large-scale subsurface
scattering will be discussed in Section 9.7.
The green circle in the left side of Figure 7.16 represents a case where
each pixel covers a larger area (perhaps the camera is farther away). In
this case, the pixel coverage is large, compared to the scale at which the
subsurface scattering occurs. At this scale reflection, refraction and sub-
surface scattering can be approximated as happening at a single point, as
seen in the right side of the figure.
This approximation enables modeling all the light interaction—including
subsurface scattering—with a BRDF. Whether a BRDF can be used de-
pends both on the surface material (for example, subsurface scattering
occurs over larger distances in wax than in marble) and on the scale of ob-
..................Content has been hidden....................

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