Graphics Reference
In-Depth Information
Notice that as the point P moves, the light arriving at the point P from direction
v doesn't change. Thus, this environment map is useful for modeling the specular
reflection of an object's surroundings, but it is not good for modeling reflections
of nearby objects, where the direction from P to some object will change substan-
tially as we vary P .
Where do we get an environment map in the first place? A fisheye-lens photo-
graph taken from the center of a scene can provide the necessary input, although
the mapping from pixels in the photograph to pixels in the environment map
requires careful resampling. In practice, it's common to use multiple ordinary
photographs, and a rather different mapping strategy from the one we've sug-
gested here, but the key idea—doing a lighting “lookup” rather than iterating over
a small list of point or area lights—remains the same.
Debevec has written an interesting first-person history of reflection mapping
in general [Deb06], tracing its first use in graphics to a paper by Blinn and Newell
in 1976 [BN76], which is long before digital photographs were available! The
“environment map” in this case was a scene created in a drawing program.
Inline Exercise 20.1: We've carefully suggested using environment mapping
in a ray tracer for describing the lighting of a mirrorlike surface. What would
be entailed in using environment mapping on a glossy surface? A diffuse one?
Would it substantially increase the computation time over that of a simpler
model in which the light was specified by a few point and area lights?
20.2.2 Bump Mapping
In bump mapping, we fiddle with another of the ingredients in the Phong model:
the surface normal, n . A typical version of this uses texture coordinates on a model
to look up a value in a bump map image and uses the resultant values to alter the
normal vector a little.
The exact meaning assigned to the RGB values from this image depends on
the implementation, but a simple version uses just R and G to “tilt” the normal
vector as follows. We'll assume that at each surface point P we have a pair of
unit vectors t 1 and t 2 that are tangent to the surface, are mutually perpendicular,
and vary continuously across the surface. In theory, it may be impossible to find
such a pair of vector fields (see Chapter 25), and in Section 20.3 we'll discuss
this further, but in practice usually only the continuity assumption is violated, and
only at a few isolated points. For example, on the unit sphere, tangents to the lines
of constant latitude and constant longitude can play the role of t 1 and t 2 , failing
the continuity requirement only at the north and south poles. If we arrange to not
perturb the normal vector at either pole, then the lack of continuity of t 1 and t 2 has
no effect.
With t 1 and t 2 in hand, we'll show how to adjust the normal vector. The R and
G values from the bump map, typically bytes representing values
128,
...
, 127,
or unsigned bytes representing 0 to 255, are adjusted to range from
1to1by
writing (in the first case)
r =max R
1.0
127 ,
(20.2)
and a corresponding expression for g .(Thelossof
128 as a distinct value is
deliberate. If we'd divided by 128, we could not represent + 1.0.)
 
 
 
Search WWH ::




Custom Search