Game Development Reference
In-Depth Information
Thus, we end up with a non-degenerate quad to represent the silhou-
ette edge, as Figure 17.7 shows.
Figure 17.7: Vertices v 2 and v 3 on a silhouette edge
being offset in the direction of their vertex normals n 2
and n 3 respectively. Observe that vertices v 0 and v 1
remain in their fixed position since their vertex nor-
mals equal the zero vector, thus no offset occurs for
them. In this way the quad is successfully regenerated
to represent the silhouette edge.
Remark: If we didn't set the vertex normals of vertices v 0 and v 1 to
the zero vector, then those vertices would have been offset as well. But
if we offset all four of the vertices describing a silhouette edge, then
we have only translated the degenerate quad. By keeping vertices v 0
and v 1 fixed and only offsetting vertices v 2 and v 3 we regenerate the
quad.
17.5.3.2 Testing for a Silhouette Edge
An edge is a silhouette edge if the two faces, face 0 and face 1 , sharing
that edge face in different directions relative to the viewing direction.
That is, if one face is front facing and the other face is back facing, then
the edge is a silhouette edge. Figure 17.8 gives an example of a silhou-
ette edge and a non-silhouette edge.
Figure 17.8: In (a), one face
that shares the edge
defined by the vertices v 0
and v 1 is front facing and
the other face that shares
the edge is back facing, thus
the edge is a silhouette
edge. In (b), the faces that
share the edge defined by
v 0 and v 1 are both front fac-
ing, and therefore the edge
is not a silhouette edge.
It follows then that in order to test if a vertex is on a silhouette edge,
we must know the normal vectors of face 0 and face 1 on a per vertex
basis. Our edge vertex data structure reflects this:
struct VS_INPUT
{
vector position : POSITION;
vector normal : NORMAL0;
vector faceNormal1 : NORMAL1;
vector faceNormal2 : NORMAL2;
};
Search WWH ::




Custom Search