i
i
i
i
i
i
i
i
454 10. Image-Based Effects
optimization is to have the billboard represent the front of the volume,
rather than its back. This enables the use of Z-buertestingtoskipparts
of the volume that are behind solid objects. This optimization is viable
only when the sphere is known to be fully in front of the viewer, so that
the billboard is not clipped by the near view plane.
10.6.3 Axial Billboard
Thelastcommontypeiscalledaxial billboarding. In this scheme the tex-
tured object does not normally face straight-on toward the viewer. Instead,
it is allowed to rotate around some fixed world space axis and align itself
so as to face the viewer as much as possible within this range. This bill-
boarding technique can be used for displaying distant trees. Instead of
representing a tree with a solid surface, or even with a pair of tree outlines
as described in Section 6.6, a single tree billboard is used. The world’s
up vector is set as an axis along the trunk of the tree. The tree faces the
viewer as the viewer moves, as shown in Figure 10.9. For this form of bill-
boarding, the world up vector is fixed and the viewpoint direction is used
as the second, adjustable vector. Once this rotation matrix is formed, the
tree is translated to its position.
A problem with the axial billboarding technique is that if the viewer flies
over the trees and looks straight down, the illusion is ruined, as the trees
will look like the cutouts they are. One workaround is to add a circular,
horizontal, cross section texture of the tree (which needs no billboarding)
to help ameliorate the problem.
Another technique is to use level of detail techniques to change from
an impostor to a three-dimensional model. Automated methods of turning
polygonal tree models into sets of billboards are discussed in Section 10.7.2.
Meyer et al. [862] give an overview of other real-time tree rendering tech-
Figure 10.9. As the viewer moves around the scene, the bush billboard rotates to face
forward. In this example the bush is lit from the south so that the changing view makes
the overall shade change with rotation.
i
i
i
i
i
i
i
i
10.7. Particle Systems 455
Figure 10.10. Billboard examples. The heads-up display (HUD) graphics and star-like
projectiles are screen-aligned billboards. The large teardrop explosions in the right image
are a viewpoint-oriented billboards. The curved beams are axial billboards made of a
number of quadrilaterals. To create a continuous beam, these quadrilaterals are joined
at their corners, and so are no longer rectangular. (Images courtesy of Maxim Garber,
Mark Harris, Vincent Scheib, Stephan Sherman, and Andrew Zaferakis, from BHX:
Beamrunner Hypercross.”)
niques. Kharlamov et al. [648] discuss algorithms used in the commercial
SpeedTree package.
Just as screen-aligned billboards are good for representing symmetric
spherical objects, axial billboards are useful for representing objects with
cylindrical symmetry. For example, laser beam effects can be rendered
with axial billboards, since their appearance looks the same from any an-
gle around the axis. See Figure 10.10 for an example of this and other
billboards. Another example is shown in Figure 3.7 on page 42, using the
geometry shader to generate the billboards on the fly.
10.7 Particle Systems
A particle system [1052] is a set of separate small objects that are set into
motion using some algorithm. Applications include simulating fire, smoke,
explosions, water flows, trees, whirling galaxies, and other phenomena.
Particle systems are not a form of rendering, but rather a method of ani-
mation. The idea is that there are controls for creating, moving, changing,
and deleting particles during their lifetimes.
There has been much written on the subject of generating and con-
trolling particle systems [849, 1295, 1331]. What is most relevant here is
the way the particles are represented. Representations even simpler than
billboards are common—namely, points and lines. Each particle can be a
single point rendered on the screen. Particles can also be represented by
billboards. As mentioned in Section 10.6.2, if the particle is round, then
i
i
i
i
i
i
i
i
456 10. Image-Based Effects
Figure 10.11. Fireworks using a single screen-aligned, alpha-textured billboard for each
particle, varied in size and shade over time. (From a DirectX demonstration program,
Microsoft.)
the up vector is irrelevant to its display. In other words, all that is needed
is the particle’s position to orient it. DirectX supports this by providing a
point sprite primitive,
4
thereby eliminating the need for a quadrilateral for
each point. Figure 10.11 shows a simple particle system, a fireworks dis-
play. In addition to an image texture representing a particle, other textures
could be included, such as a normal map. Another rendering technique is
to represent a particle by a line segment drawn from the particle’s previous
location to its current location. Axial billboards can be used to display
thicker lines. See Figure 10.43 on page 504 for an example of rain using
lines.
LeGrand [753] discusses implementing particle systems with vertex
shaders. Modern GPUs can also generate animation paths for sprites and
even perform collision detection. A number of researchers use the pixel
shader to generate successive locations for the particles, which the vertex
shader then accesses to generate sprites [665, 682, 737]. Collision detec-
tion with the environment and among particles themselves can also be
performedontheGPU.
DirectX 10 further supports particles by using the geometry shader
and stream output to control the birth and death of particles. This is done
by storing results in a vertex buffer and updating this buffer each frame
entirely on the GPU [261, 387]. An example is shown in Figure 10.12.
In addition to animating explosions, waterfalls, rain, froth, and other
phenomena, particle systems can also be used for rendering. For example,
some trees can be modeled by using particle systems to represent the ge-
ometry, with more particles generated and displayed as the viewer comes
closer to the model.
4
DirectX 10 eliminated this primitive, since the same functionality (expanding a
single vertex into a quadrilateral) is supported by the geometry shader.
i
i
i
i
i
i
i
i
10.7. Particle Systems 457
Figure 10.12. Particle system used in “Cascades” demo [387]. The water particles have
different representations, dependent on state. (Image courtesy of NVIDIA Corporation.)
10.7.1 Impostors
An impostor
5
is a billboard that is created on the fly by rendering a complex
object from the current viewpoint into an image texture, which is mapped
onto the billboard. The rendering is therefore proportional to the number
of pixels the impostor covers on the screen, instead of the number of vertices
or the depth complexity of the object. The impostor can be used for a few
instances of the object or a few frames so that a performance increase is
obtained. In this section different strategies for updating impostors will be
presented.
The impostor image is opaque where the object is present; everywhere
else it is totally transparent. Sometimes, impostors are called sprites. One
of the best uses for impostors is for collections of small static objects [352].
Impostors are also useful for rendering distant objects rapidly. A different
approach is to instead use a very low level of detail model (see Section 14.7).
However, such simplified models often lose shape and color information.
Impostors do not necessarily have this disadvantage, since a higher quality
impostor can be created [20, 1358]. Another advantage is that the texture
image can be lowpass filtered to create an out-of-focus image for a depth-
of-field effect.
5
Maciel and Shirley [806] identify several different types of impostors in 1995, includ-
ing the one presented in this section. Since that time, the definition of an impostor has
narrowed to the one we use here [352].
i
i
i
i
i
i
i
i
458 10. Image-Based Effects
c
c
n
Figure 10.13. At the left, an impostor is created of the object viewed from the side by
the viewing frustum. The view direction is toward the center, c, of the object, and an
image is rendered and used as an impostor texture. This is shown on the right, where
the texture is applied to a quadrilateral. The center of the impostor is equal to the
center of the object, and the normal (emanating from the center) points directly toward
the viewpoint.
In practice, an impostor should be faster to draw than the object it
represents, and it should closely resemble the object. Also of importance is
that an impostor should be reused for several viewpoints located close to-
gether, and therefore efficiently exploits frame-to-frame coherence. This is
usually the case because the movement of the projected image of an object
diminishes with an increased distance from the viewer. This means that
slowly moving objects that are located far from the viewer are candidates
for this method. Another situation in which impostors can be used is for
objects located close to the viewer that tend to expose the same side to the
viewer as they move [1112].
Before rendering the object to create the impostor image, the viewer is
set to view the center of the bounding box of the object, and the impostor
polygon is chosen so as to point directly toward the viewpoint (at the left
in Figure 10.13). The size of the impostor’s quadrilateral is the smallest
rectangle containing the projected bounding box of the object.
An impostor of an object is created by first initializing the alpha channel
of an offscreen buffer to α =0.0 (i.e., fully transparent). The object is
then drawn into an offscreen image, with the alpha channel set to opaque
(α =1.0) where the object is present. The pixels that are not written retain
their transparency. Similar to deferred shading, a normal map or other
textures could also be generated and used to later render the impostor.
The impostor image is then used as a texture (or textures) on the
polygon. Once created, the rendering of the impostor starts with placing
the impostor polygon at the center of the bounding box, and orienting the
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset