Graphics Reference
In-Depth Information
y
2
, with
the constant of proportionality chosen so that each integrates to one on the
sphere. In spherical polar coordinates, they can be written 1,
cos
to 1,
x
,
y
,
z
,
xy
,
yz
,
zx
, and
x
2
in
xyz
-coordinates, are proportional
−
θ
,
sin
θ
,
sin
φ
,
sin
2
. Like the Fourier basis functions on the
circle, they are pairwise orthogonal: The integral of the product of any two distinct
harmonics over the sphere is zero. Figure 31.17 shows the first few harmonics,
plotted radially. The plot of
h
1
, which is the constant function 1, yields the unit
sphere.
θ
,
sin
θ
sin
φ
,
cos
θ
cos
φ
, and
cos
2
θ
To be clear: If you have a continuous function
f
:
S
2
→
R
, you can write
f
as
asum
3
of spherical harmonics:
f
(
P
)=
∞
c
j
h
j
(
P
)
.
(31.58)
j
=
1
The coefficients
c
j
depend on
f
, of course, just as when we wrote a function on the
unit circle as a sum of sines and cosines, the coefficients of the sines and cosines
depended on the function. In fact, they're determined the same way: by computing
integrals.
The cosine-weighted BRDF at a fixed point
P
is a function of two directions
v
i
and
v
o
, that is, the expression
f
(
v
i
,
v
o
)=
f
s
(
P
,
v
i
,
v
o
)
v
i
·
n
(
P
)
(31.59)
defines a map
f
:
S
2
S
2
R
. So the preceding statement about representing
functions on
S
2
via harmonics does not directly apply. But we
can
approximate the
cosine-weighted BRDF
f
at
P
with spherical harmonics in a two-step process. To
simplify notation, we'll omit the argument
P
for the remainder of this discussion.
First, we fix
×
→
f
(
v
o
)
; this function on
S
2
—let's call it
F
v
i
—can be expressed in spherical harmonics:
v
i
and consider the function
v
o
→
v
i
,
Figure 31.17: The first few spher-
ical harmonics. For each point
on the unit sphere
v
o
)=
∞
F
v
i
(
c
j
h
j
(
v
o
)
.
(31.60)
in
spherical polar coordinates, we
plot a point
(
r
,
θ
,
φ
)
,wherer
=
|
h
j
(
θ
,
φ
)
|
. The absolute value
avoids problems where negative
values get hidden, but is slightly
misleading.
(
1,
θ
,
φ
)
j
=
1
If we chose a different
v
i
, we could repeat the process; this would get us a different
collection of coefficients
{
c
j
}
. We thus see that the coefficients
c
j
depend on
v
i
;
we can think of these as functions of
v
i
and write
v
o
)=
j
f
(
v
i
,
c
j
(
v
i
)
h
j
(
v
o
)
.
(31.61)
Now each function
v
i
)
is itself a function on the sphere, and can be
written as a sum of spherical harmonics. We write
v
i
→
c
j
(
v
i
)=
k
c
j
(
w
jk
h
k
(
v
i
)
.
(31.62)
Substituting this expression into Equation 31.61, we get
f
(
v
o
)=
j
v
i
,
c
j
(
v
i
)
h
j
(
v
o
);
(31.63)
=
j
w
jk
h
k
(
v
i
)
h
j
(
v
o
)
.
(31.64)
k
3.
Limiting to a finite sum gives an approximation to the function; if
f
is discontinu-
ous, then the sum converges to
f
only in regions of continuity.