Graphics Reference
In-Depth Information
uv=(1,0) V d
uv=(0,0)
(0,0)
(1,0)
V a
s
t 1 = v 1
P a
T a
(u 1 , v 1 )
s 1 = u 1
returns color (C a )
at texel
(s 1 , t 1 ) = (u 1 , v 1 )
linearly interpolated
from
surrounding vertices
rectangle
primitive
texture map
V b
V c
(0,1)
(1,1)
t
uv=(0,1)
uv=(1,1)
Figure 12.15.
Texel value look-up.
• Look up the values associated with the identified texel and use these values
for computing the color of the pixel.
For example, as illustrated in Figure 12.15, at pixel position P a the texture coordi-
nate
is computed based on interpolating the uv values from the surround-
ing three vertices: V a , V b ,and V d .The
(
u 1 ,
v 1 )
values are then used as reference
into the st coordinate space to identify a texel T a . The value of the texel C a is
returned for computing the color of the pixel.
(
u 1 ,
v 1 )
Figure 12.16.
Simple
scene
with blending
dis-
abled.
12.3.4
Using the Texel Values
The most straightforward usage of the looked-up texel value C a is to treat it as a
color and simply assign it into the destination pixel D :
D
C a
The square in Figure 12.12 is computed based on this straightforward assignment.
Alpha channel in image files.
Not all image file formats sup-
port the storing of the α chan-
nel for each pixel. For exam-
ple, the jpg file format does
not support storing of α chan-
nel, whereas the png file for-
mat supports the storing of
From the discussion in Section 12.2 and from Equation (12.3), we understand that
modern graphics hardware supports more interesting functions in computing the
color of the destination pixel. For example, it is virtually impossible to identify
the circle primitive in Figure 12.12. Figure 12.16 shows the same image with
α
blending disabled for the circle primitive. We see that in addition to basic
(
r
,
g
,
b
)
,
α
a file texture can also contain
α
information for each pixel. In this case, with the
channel.
per-pixel
information, when blending is enabled the portions of the circle with
file texture of
α
α =
0 become completely transparent.
Search WWH ::




Custom Search