Graphics Reference
In-Depth Information
f r ( P ,
θ i ,
θ o ,
φ i ,
φ o )= f s ( P ,
v i ,
v o ) .
(32.2)
The function f r is what a gonioreflectometer actually measures. Notice that f s and
f r are merely different representations of the same thing, like the rectangular- or
polar-coordinate representations of a curve. (We discussed such shifts of represen-
tation in Chapter 14)
The function f s has a form in which certain common properties of BSDFs
can be easily expressed. For instance, the Lambertian bidirectional reflectance
distribution function (BRDF) is completely independent of
φ o . Because
of this, the particular choice of u and v is irrelevant for the Lambertian BRDF: The
dot products of
θ o ,
φ i , and
v i and
v o with u and v are only used in computing
φ i and
φ o .
The Phong and Blinn-Phong BRDFs both depend on
θ i and
θ o , but their depen-
dence on
φ i and
φ o is rather special: They depend only on the difference of
φ i −φ o
(indeed, on this difference taken mod 2
π
).
Inline Exercise 32.3: (a) Explain the claim that the Blinn-Phong BRDF
depends only on the difference of
φ o .
(b) Show that in fact it depends only on the magnitude of the difference: The
sign is irrelevant.
φ i and
This dependence on the difference in angles again means that the BSDF
expressed in (
) terms, f s , is independent of the choice of u and v : If we rotated
these in the tangent plane by some amount
θ
,
φ
α
, then both
φ i and
φ o would change by
α
) would remain
invariant. BSDFs with this property are said to be isotropic, and they can be rep-
resented by functions of the three variables
(and possibly by an additional 2
π
), and their difference (mod 2
π
.The
great majority of materials currently used in graphics are represented by BSDFs
(indeed, BRDFs) that fall into this category; the exceptions ( anisotropic mate-
rials) are things like brushed aluminum, in which the brushing direction intro-
duces an anisotropy. Materials that are represented using subsurface scattering
often have interior structure that makes them anisotropic as well, so the simplified
representation is often inapplicable to those.
The preceding discussion has been in terms of the angles
θ i ,
θ o , and
φ
=(
φ i −φ o )mod 2
π
φ o to
emphasize that the BSDF is a function on a four-dimensional domain. In practice,
however, it is the sines and cosines of these angles that most often enter into the
computations, at least for analytically expressed BSDFs. (For tabulated BSDFs,
we can tabulate based not on
θ i ,
φ i ,
θ o , and
θ o , but on their cosines, so the same argument
applies to those.) In practice, a BSDF implementation will typically take a point,
P , and the two vectors
θ i and
v i and
v o , and promptly express these vectors in terms of
u , v , and n .
How does all this look in an implementation? Part of G3D's implementation
of a generalized Blinn-Phong model is shown in Listing 32.1.
There are several design choices here. The first is that a SurfaceElement is
used to represent the intersection of a ray with a surface in the scene. Among
other things, it has data members material and shading .The material stores
things like the Phong exponent, the reflectivities in the red, green, and blue spec-
tral regions, etc. The shading stores the intersection point, the texture coordinates
there, and the surface normal there. (It may help, when reading expressions like
p.shading.normal , to treat “shading” as an adjective. Thus, p.shading.normal
is the shading normal, while p.geometric.normal is the geometric normal.)
 
 
Search WWH ::




Custom Search