It is often desirable to replace intricate geometry with simpler texture mapped geometry to increase realism and performance. Billboarding is a technique in which complex objects such as trees are drawn with simple planar texture mapped geometry and the geometry is transformed to face the viewer. The transformation typically consists of a rotation to orient the object towards the viewer and a translation to place the object in the correct position. For the case of the tree, an object with roughly cylindrical symmetry, an axial rotation is used to rotate the geometry for the tree, typically a quadrilateral, about the axis running parallel to the tree trunk.
For the simple case of the viewer looking down the negative
z-axis and the up vector equal to the positive y-axis, the
angle of rotation can be determined by computing the eye
vector from the model view matrix M
Once is computed, construct a rotation matrix Rrepresenting this rotation about the y-axis ( ). Then concatenate this rotation matrix with the modelview matrix to make a combined matrix called MR. Use this combined matrix to transform the billboard geometry.
To handle the more general case of an arbitrary billboard
rotation axis, an intermediate alignment rotation A of
the billboard axis into the
axis is computed as
In addition to objects which are cylindrically symmetric, it is also useful to compute transformations for spherically symmetric objects such as smoke, clouds and bushes. Spherical symmetry allows billboards to rotate up and down as well as left and right, whereas cylindrical behavior only allows rotation to the left or right. Cylindrical behavior is suited to objects such as trees which should not bend backward as the viewer's altitude increases.
Objects which are spherically symmetric are rotated about a point to face the view and thus provide more freedom in computing the rotations. An additional alignment constraint can resolve this freedom. For example, an alignment constraint which keeps the object oriented in a consistent fashion, such as upright. This constraint can be enforced in object coordinates when the objective is to maintain scene realism, perhaps to maintain the orientation of plume of smoke consistently with other objects in a scene. The constraint can also be enforced in eye coordinates which can be used to maintain alignment of an object relative to the screen, for example, keeping annotations such as text aligned horizontally on the screen.
The computations for the spherically symmetric case are a minor extension
of the computations for the arbitrarily aligned cylindrical case. First an
alignment transformation, A, is computed to rotate the alignment axis
onto the up vector followed by a rotation about the up vector to align the
face of the billboard with the eye vector.
A is computed as
where
is the billboard alignment axis with
the component in the direction of the eye direction vector removed
A rotation about the up vector is then computed as for the cylindrical case.