Graphics Reference
In-Depth Information
There is also an interpolation for texture coordinates.
The texture coordinates for each vertex are interpolated to
get the texture coordinates for the boundary pixels, and
the texture coordinates of the endpoints of a fragment are
interpolated to get the texture coordinates for each pixel in
the fragment. After the texture coordinates for each pixel
are computed, the texture coordinates are sent to the tex-
ture space and texel values are returned to be combined
with other pixel information as specified in your texture
specifications.
The kind of interpolation done for texture coordi-
nates depends on your texture quality hint. If you ask for
“fastest” you might get a simple linear interpolation, but if
you ask for “best” the texture coordinates are interpolated
based on a perspective interpolation. Figure 1.8 shows the
difference between linear and perspective interpolation
for texture coordinates applied to a single quad seen as
two triangles. Many graphics systems do not distinguish
between “fastest” and “best,” so you may not see this dif-
ference on your own system.
Simple linear interpolation is a familiar technique.
Given a general data value f with values f a and f b at the
two endpoints a and b of a line segment, linear interpo-
lation with linear parameter t is typically given by the
function
Figure 1.8. Texture mapping a check-
erboard patern on a quad without
perspective correction (top) and with
perspective correction (botom).
(
)
tf t a b .
If the data values f are in homogeneous coordinates ( r , s , t , q ) with q ≠ 1, then
you must convert the coordinates into standard form by dividing each f by the
values of q and interpolate the f / q values:
1−
+
(
)
1−
tfqt fq
aa bb .
+
This last case clearly is the same as the first case if f a and f b are already in stan-
dard homogeneous form.
As usual in interpolations, we notice that if t = 0, the function has value f a ,
while if t = 1, the function has value f b . The value of the interpolating parameter
t that would give a particular pixel in the interpolating line can be computed by
t pp pp
pp
(
) •−
(
)
(
) •−
(
)
pp pp
pp pp
r
a
b
a
r
a
b
a
=
=
(
) •−
(
)
2
b
a
b
a
b
a
Search WWH ::




Custom Search