i
i
i
i
i
i
i
i
166 6. Texturing
The intent of computing the coordinate d is to determine where to
sample along the mipmap’s pyramid axis (see Figure 6.14). The goal is a
pixel-to-texel ratio of at least 1:1 in order to achieve the Nyquist rate. The
important principle here is that as the pixel cell comes to include more
texels and d increases, a smaller, blurrier version of the texture is accessed.
The (u, v, d) triplet is used to access the mipmap. The value d is analogous
to a texture level, but instead of an integer value, d has the fractional value
of the distance between levels. The texture level above and the level below
the d location is sampled. The (u, v) location is used to retrieve a bilinearly
interpolated sample from each of these two texture levels. The resulting
sample is then linearly interpolated, depending on the distance from each
texture level to d. This entire process is called trilinear interpolation and
is performed per pixel.
One user control on the d coordinate is the level of detail bias (LOD
bias). This is a value added to d, and so it affects the relative perceived
sharpness of a texture. If we move further up the pyramid to start (in-
creasing d), the texture will look blurrier. A good LOD bias for any given
texture will vary with the image type and with the way it is used. For
example, images that are somewhat blurry to begin with could use a nega-
tive bias, while poorly filtered (aliased) synthetic images used for texturing
could use a positive bias. The bias can be specified for the texture as a
whole, or per-pixel in the pixel shader. For finer control, the d coordinate
or the derivatives used to compute it can be supplied by the user, in any
shader stage.
The result of mipmapping is that instead of trying to sum all the texels
that affect a pixel individually, precombined sets of texels are accessed
and interpolated. This process takes a fixed amount of time, no matter
what the amount of minification. However, mipmapping has a number of
flaws [345]. A major one is overblurring. Imagine a pixel cell that covers a
large number of texels in the u direction and only a few in the v direction.
This case commonly occurs when a viewer looks along a textured surface
nearly edge-on. In fact, it is possible to need minification along one axis
of the texture and magnification along the other. The effect of accessing
the mipmap is that square areas on the texture are retrieved; retrieving
rectangular areas is not possible. To avoid aliasing, we choose the largest
measure of the approximate coverage of the pixel cell on the texture. This
results in the retrieved sample often being relatively blurry. This effect can
be seen in the mipmap image in Figure 6.13. The lines moving into the
distance on the right show overblurring.
One extension to mipmapping is the ripmap. The idea is to extend the
mipmap to include downsampled rectangular areas as subtextures that can
be accessed [518]. The mipmap is stored 1 × 1, 2 × 2, 4 × 4, etc., but all
possible rectangles are also stored 1 × 2, 2 × 4, 2 × 1, 4 × 1, 4 × 2, etc.