Game Development Reference
In-Depth Information
These vertices are arranged in a counterclockwise winding order so that the front
of the quad faces the camera. The corresponding two-dimensional texture map-
ping coordinates are given by
s
,
t
=
1,1
s
,
t
=
0,1
11
2 2
st
,
=
0, 0
st
,
=
1, 0
.
(9.21)
33
44
Billboarded quads whose vertices derive from the vectors X and Y given by
Equation (9.18) are always aligned to the plane of the camera. As Figure 9.5
demonstrates, this alignment can differ significantly from the plane perpendicular
to the true direction from the quad's center to the camera position. When hun-
dreds or thousands of small particles are being rendered, one may wish to use
Equation (9.18) for efficiency, but large quads may look better if oriented to face
the actual camera position instead of the plane of the camera.
We align a quad so that it faces the camera position by presenting a more
computationally expensive formulation of the vectors X and Y . Let the vector C
denote the world space camera position. Assuming that the center P of the quad
does not lie on the line containing C and running in the direction U , we can
calculate
CP
Z CP
UZ
A UZ
BZA
=
= ×
.
(9.22)
Figure 9.5. A billboarded quad that is aligned to the plane of the camera may differ sig-
nificantly from a quad that directly faces the camera position.
Search Nedrilad ::




Custom Search