Graphics Reference
In-Depth Information
expressive rendering) generate images that serve as auxiliary data for creating a
final rendering. If we take an object ID image, for instance, and identify points
at which the object ID changes and color those black, while coloring other points
white, we get a picture of the boundaries between entities in the scene, a kind of
condensed representation of the relationships among entities in the image.
17.5.1 Nomenclature
The term “image” is reserved by some for arrays of color or grayscale values; they
prefer to call something that contains an object ID at every point a map instead,
in analogy with things like topographical maps, which contain, at each location,
information about the height or roughness of some terrain. Unfortunately, the term
“map” is already used in mathematics to mean a (usually continuous and one-to-
one) function between two spaces. To the degree that a graphics “map” associates
to each point of the plane some value (like an object ID or a transparency), the map
is a particular instance of the more general mathematical notion. Further confu-
sion arises when we examine texture mapping, in which we must associate to each
point of a surface a pair of texture coordinates, and then use these coordinates to
index into some image; the color from the image is used as the color for the sur-
face. Both the image itself and the assignment of texture coordinates to surface
points are part of the texture-mapping process. Is the image a texture map? (This
usage is common.) Is the assignment of coordinates actually “texture mapping”?
(This usage is less common, but it more closely matches the mathematical notion
of mapping.) You'll see “map” and “image” used, in the literature, almost inter-
changeably in many places. Fortunately, the meaning is usually fairly clear from
context.
17.6 MIP Maps
As we'll see when we discuss texture mapping in Chapter 20, it's often important
to have multiple representations of the color image that's used in texturing. Lance
Williams developed MIP maps (“MIP” stands for “multum in parvo,” Latin for
“many in small”) for this very reason. In a MIP map (see Figure 17.5) we store
not only an image, but also copies of the image shrunk by varying amounts along
the two axes.
The “shrinking” process used to reduce the number of columns by a factor of
two is very simple; pairs of adjacent columns are averaged, as shown in Listing
17.1. Analogous code is used to halve the number of rows. The process is repeated,
for both rows and columns, until we reach a 1
×
1 image as shown in Figure 17.5.
Listing 17.1: One stage of column reduction for MIP mapping.
1
2
3
4
5
foreach row of image {
for(int c = 0; c < number of columns /2; c++){
output[row,c] = (input[row, 2 * c] + input[row, 2 * c+1])/2;
}
}
In Chapter 19 you'll learn the techniques necessary to analyze the MIP-
mapping process and determine its limitations. But for now, let's simply consider
the problem of how to MIP-map an image with more than color data. Suppose
 
 
 
 
Search WWH ::




Custom Search