Graphics Reference
In-Depth Information
up a value at location ( u , v ) in an image whose domain is parameterized by
0
1,” but there are many other possibilities.
Much of this chapter elaborates on this idea, discussing the parameters that can
be varied, the codomains for texture coordinates (i.e., the meaning of the values
that they take on), and mechanisms for defining mappings from a mesh to the
space of coordinates.
You'll notice that this entire notion of “texture mapping” is really just a name
for indirection as applied in a specific context: We use an index (the texture coor-
dinates) to determine a value. This determination may be performed by a table
lookup (as in the case of the soft-drink can above, where the texture image serves
as the “table”) or by a more complex computation, in which case it's often called
procedural texturing.
An example of the power of various mapping operations is given by this topic's
cover image, in which almost every object you see has had multiple maps applied
to it—color, texture, displacement, etc.—resulting in a visual richness that would
be almost impossible to achieve otherwise.
u , v
20.2 Variations of Texturing
We'll illustrate several variations on the idea of texture mapping, working with
the Phong reflection model as an exemplar. The ideas we present are largely inde-
pendent of the reflection model, and they apply more generally. Because the unit
square 0
1 occurs so often in this chapter, we'll give it a name, U , which
we'll use in this chapter only.
Recall that in the Phong model of Chapter 6, the light scattered from a surface
is defined by various constants (the diffuse reflection coefficient k d , the specular
reflection coefficient k s , the diffuse and specular colors C d and C s , and the specular
exponent n ), dot products of various unit vectors, including the direction vector to
the light source, the direction vector from the surface to the eye, the surface normal
vector, and finally, the arriving light. There is also, in some versions of the model,
an ambient term, modeled by k a and C a , indicating an amount of light emitted by the
surface independent of the arriving light. Each of these things—the constants, the
vectors, and even the way you compute the dot product—is a candidate for mapping.
u , v
20.2.1 Environment Mapping
If our surface is mirrorlike (i.e., k d = k a = 0, and n is very large, or even infinite),
then the light scattered toward the eye, as determined by the Phong model, is
computed by reflecting the eye ray through the surface normal to get a ray that
may point toward a light source (in which case light is scattered) or not. If all
sources are point sources, this tends to result in no rendered reflection at all, since
the probability of a ray hitting any particular source is zero. If the sources are area
sources, we see them reflected in our object.
We can replace our model of light arriving at the surface point P from one
based on a few point or area sources to one based on a texture lookup: We can
treat the reflected eye vector as a point of the unit sphere, and use it to index into
a texture-mapped sphere to look up the arriving light. In practical terms, if we
write this eye vector in polar (world) coordinates, (
θ
,
φ
) , for instance, we can use
, v = π
u = 2 π
+ 2 to index into an environment map that contains, at location
( u , v ) , the light arriving from the corresponding direction.
 
 
 
Search WWH ::




Custom Search