Game Development Reference
In-Depth Information
Chapter 14
Particle Systems
Many natural phenomena consist of many small particles that all
behave in a similar manner (for example, flakes of snow falling, sparks
from a firework, and the “bullets” a futuristic space gun emits). Particle
systems are used to model such phenomena.
Objectives
To learn the attributes that we give to a particle and how we
describe a particle in Direct3D
To design a flexible particle system base class that includes attrib-
utes and methods general to all particle systems
To model three concrete particle systems, namely snow, an explo-
sion, and a particle gun
14.1 Particles and Point Sprites
A particle is a very small object that is usually modeled as a point math-
ematically. It follows then that a point primitive ( D3DPT_POINTLIST of
D3DPRIMITIVETYPE ) would be a good candidate to display particles.
However, point primitives are rasterized as a single pixel. This does not
give us much flexibility, as we would like to have particles of various
sizes and even map entire textures to these particles. Before Direct3D
8.0, the way to get around the limitations of point primitives was to not
use them at all. Instead, programmers would use a billboard to display a
particle. A billboard is a quad whose world matrix orients it so that it
always faces the camera.
Direct3D 8.0 introduced a special point primitive called a point
sprite that is most applicable to particle systems. Unlike ordinary point
primitives, point sprites can have textures mapped to them and can
change size. Unlike billboards, we can describe a point sprite by a sin-
gle point; this saves memory and processing time because we only
have to store and process one vertex over the four needed to store a
billboard (quad).
235
Search WWH ::




Custom Search