Game Development Reference
In-Depth Information
One application of cube texture maps on some graphics hardware is that of
normalizing vectors. A normalization cube map is a cube texture map that, in-
stead of storing color images in each of its six faces, stores an array of vectors
that are encoded as RGB colors using the following formulas.
x
+
1
red
=
2
y
+
1
green
=
2
z
+
1
blue
=
(7.16)
2
The vector stored at each pixel of a face of the cube map is the unit length vector
,,
s tp that causes that pixel to be sampled. The use of a normalization cube map
becomes desirable when performing per-pixel lighting because interpolation of
surface normals across the face of a triangle inexorably produces normal vectors
whose length is less than unity.
7.5.4 Filtering and Mipmaps
When a model is rendered with a texture map applied to its surface, it is almost
never the case that the resolution of a texture map matches the resolution of the
viewport in which it is displayed. As a model moves closer to the camera, the
relative resolution of the viewport increases compared to that of the texture map.
Using only one sample from the texture map at each pixel results in a blocky ap-
pearance, so rendering hardware normally fetches four samples from the texture
map at each pixel and blends them together. In a process called bilinear filtering ,
the four samples are blended using a weighted average that depends on the exact
texture coordinates corresponding to the pixel being rendered.
Suppose a two-dimensional texture map having width w and height h is being
sampled using the texture coordinates
s t and make the following definitions.
i
=−
s
1
2
 
=−
j
t
1
2
 
(
)
α
=
frac
frac
ws
1
2
(
)
β
=
ht
(7.17)
1
2
The bilinearly filtered texture value is given by
Search Nedrilad ::




Custom Search