Game Development Reference
In-Depth Information
Figure 9.1. A blast mark decal applied to a curved surface. ( Image from the C4 Engine,
courtesy of Terathon Software LLC. )
9.2.1 Decal Mesh Construction
We begin with a point P that lies on an existing surface and a unit normal direc-
tion N that is perpendicular to the surface at that point. The point P represents the
center of the decal and may be the point at which a projectile has hit the surface
or the point where a character's foot has stepped upon the ground. A unit tangent
direction T must also be chosen to determine the orientation of the decal. This
configuration is illustrated in Figure 9.2.
Given the point P and the directions N and T , we have an oriented plane that
is tangent to the surface geometry at P . We can carve a rectangle out of this plane
that represents the area of our decal by constructing four boundary planes that are
parallel to the normal direction N . Let w and h be the width and height of the de-
cal. Then the 4D vectors corresponding to the four border planes are given by