Graphics Reference
In-Depth Information
1
0.8
0.6
0.4
0.2
0
2 0.2
2
0.4
2 0.6
1
2
0.8
0
2
1
1
0.5
0
1 2
1
2
0.5
2
Figure 9.11: An octahedron on which each face has a different color gradient. At each
vertex of the octahedron, we need to store four different colors, one for each of the faces.
triangles have the same color at each vertex. The way to generate a color function
for this shape is to consider a function defined on a larger domain than the ver-
tices. Consider all vertex-triangle pairs in which the triangle contains the vertex,
that is,
Q =
{
( v , t ): v
}⊂
t
V
×
T ,
(9.17)
where V and T are the sets of vertices and triangles of the mesh, respectively.
Until now, we've taken a function defined h in V and extended it to all points of
the mesh. We now instead define a function on Q and extend this to all points
of the mesh. A point in a triangle t with vertices i , j , and k gets its value by a
barycentric interpolation of the values h ( i , t ) , h ( j , t ) , and h ( k , t ) .
This leads to one important problem: A point on the edge ( i , j ) is a point of
two different triangles. What color should it have? The answer is “It depends.”
From a strictly mathematical standpoint, there's no single correct answer; there
will be a color associated to the interpolation of colors on one face, and a different
one associated to the interpolation of colors on the other face. Neither is implicitly
“right.” The best we can do is to say that interpolation defines a function on
U =
{
( P , t ): P
}⊂
t
M
×
T ,
(9.18)
where P is a point of the mesh M ; that is, for each point P and each triangle t
that contains it, we get a value h ( P , t ) . Since most points are in only one trian-
gle, the second argument is generally redundant. But for those in more than one
triangle, the function value is defined only with reference to the triangle under
consideration.
9.6 Application: Texture Mapping
We mentioned in Chapter 1 that models are often described not only by geometry,
but by textures as well: To each point of an object, we can associate some property
(surface color is a common one), and this property is then used in rendering the
 
 
 
Search WWH ::




Custom Search