Title: Particle Systems
1Particle Systems Boids
- Computer Animation SS2007
2Introduction
- The term particle system is loosely defined in
computer graphics - It has been used to describe modelling
techniques, rendering techniques, and even types
of animation - In fact, the definition of a particle system
seems to depend on the application that it is
being used for
3Introduction
- Particle systems are used to model fuzzy objects,
such as fire, clouds, smoke, water, etc. - Objects such as these don't have smooth
well-defined surfaces - They are non-rigid objects, i.e., they are
dynamic and fluid
4Criteria
- A particle system is composed of one or more
individual particles - Each of these particles has attributes that
directly or indirectly effect the behavior of the
particle or ultimately how and where the particle
is rendered - Often, particles are graphical primitives such as
points or lines, but they are not limited to this
5Particle Systems Vs. Normal Representations
- Particle systems ...
- Are modelled as clouds of primitive particles
that define its volume - Are not static entities their particles change
form and move particles are created and
destroyed - Stochastic processes are used to create and
change an object's shape and appearance - Particle systems can be used in a deterministic
way to create certain objects
6Stochastic Procedural Modelling
- Particle systems are similar to fractals, and
have some of the same advantages - Complex systems can be created with little human
effort - The level of detail can be easily adjusted
- For example
- If a particle system object is in the distance,
then it can be modelled to low detail (few
particles)? - If it is close to the camera, then it can be
modelled in high detail (many particles)?
7Art-Based Rendering of Fur, Grass, and
TreesKowalski et alSIGGRAPH '99 Conference
Proceedings
8Basic Model of Particle Systems
- For each frame of an animation sequence the
following steps are performed - New particles are generated
- Each new particle is assigned its own set of
attributes - Any particles that have existed for a
predetermined time are destroyed - The remaining particles are transformed and moved
according to their dynamic attributes - An image of the remaining particles is rendered
9Basic Model of Particle Systems
- Since the creation and attributes of the
particles are procedural, these can be the
results of other computations, e.g. from science
or engineering
10Random Factor
- A common characteristic of all particle systems
is the introduction of some type of random
element - This random element can be used to control the
particle attributes such as position, velocity
and color - Usually the random element is controlled by some
type of predefined stochastic limits, such as
bounds, variance, or type of distribution.
11Generation
- Particles in the system are generated randomly
within a predetermined location of the fuzzy
object - This space is termed the generation shape of the
fuzzy object, and this generation shape may
change over time - Each of the above mentioned attributes is given
an initial value that may be fixed or may be
determined by a stochastic process
12Generation
- Method 1 Number of particles generated at frame
F - NpartsF MeanPartsF Rand() X VariancePartsF
- Where -1.0 lt Rand() lt 1.0 , a uniformly
distributed random number
13Generation
- Method 2 MeanParts and VarianceParts refer to a
number per unit screen area - NpartsF (MeanPartsSAF Rand() X
VariancePartsSAF) X ScreenArea - This method is good for controlling the level of
detail required - Note SAF means per screen area for frame F
14Generation
- To change the number of particles generated as
time changes one can use a simple linear
function - MeanPartsF InitialMeanParts DeltaMeanParts X
(F-F0)?
15Particle Attributes
- Each new particle has the following attributes
- Position
- Velocity (speed and direction)?
- Size
- Color
- Transparency
- Shape
- Lifetime
16Parameters
- A particle system has several parameters that
control the initial position of the particles - X, Y, Z (the particle system origin)?
- Two angles of rotation that give its orientation
- A generation shape which defines the region
around the origin in which new particles are
placed, e.g., a sphere of radius R. These shapes
can be simple or quite complicated.
17Generation Shape
- Describes the initial direction of new particles,
e.g., for a sphere the particles would move away
from the origin in all directions - For a planar shape, e.g. a circle in the x-y
plane, the particles would move up and away from
the plane (not necessarily straight up, this
would be determined by the rotation angles)?
18Initial State
- Speed MeanSpeed Rand() X VarSpeed
- Color MeanColor (R,G,B) Rand() X
VarColor(R,G,B)? - Opacity MeanOpacity (R,G,B) Rand() X
VarOpacity(R,G,B)? - Size MeanSize Rand() X VarSize
19Initial State
- There is also a parameter that specifies the
shape of each particle, e.g., spherical,
rectangular, or streaked spherical (for motion
blur).
20Particle Dynamics
- The attributes of each of the particles may vary
over time - For example, the color of a particle in an
explosion may get darker as it gets further from
the center of the explosion, indicating that it
is cooling off - In general, each of the particle attributes can
be specified by a parametric equation with time
as the parameter
21Particle Dynamics
- Particle attributes can be functions of both time
and other particle attributes - For example, particle position is going to be
dependent on previous particle position and
velocity as well as time
22Particle Dynamics
- A particle's position in each succeeding frame
can be computed by knowing its velocity (speed
and direction of movement)? - This can be modified by an acceleration force for
more complex movement, e.g., gravity simulation
23Particle Dynamics
- A particle's color can be modified by a
rate-of-color-change parameter, its opacity by a
rate-of-opacity-change parameter, and its size by
a rate-of-size-change parameter - These rates of change can be global, i.e. the
same for all particles, or they can be stochastic
for each particle
24Extinction
- Each particle has two attributes dealing with
length of existence age and lifetime - Age is the time that the particle has been alive
(measured in frames), this value is always
initialized to 0 when the particle is create - Lifetime is the maximum amount of time that the
particle can live (measured in frames)? - When the particle age matches it's lifetime it is
destroyed
25Extinction
- In addition there may be other criteria for
terminating a particle prematurely - Running out of bounds
- If a particle moves out of the viewing area and
will not re-enter it, then there is no reason to
keep the particle active - Hitting the ground
- It may be assumed that particles that run into
the ground burn out and can no longer be seen - Some attribute reaches a threshold
- For example, if the particle color is so close to
black that it will not contribute any color to
the final image, then it can be safely destroyed
26Rendering
- During rendering, some assumptions have to be
made to simplify the process - First, each particle is rendered to a small
graphical primitive (blob)? - Particles that map to the same pixels in the
image are additive - the color of a pixel is
simply the sum of the color values of all the
particles that map to it
27Rendering
- Because of this assumption, no hidden surface
algorithms are needed to render the image, the
particles are simply rendered in order - Effects like temporal anti-aliasing (motion blur)
are made simple by the particle system process - The position and velocity are known for each
particle - By rendering a particle as a streak, motion blur
can be achieved.
28Rendering
- Particles can obscure other particles behind
them, can be transparent, and can cast shadows on
other particles - They can also interact with other, conventionally
modelled primitives - If the particles do interact with other objects,
e.g., go behind them, then the images are divided
into sub-images which are composited
29Rendering
- A second approximation is that the particles are
light sources, that additively combine according
to their color and opacity values - This eliminates the hidden surface problem since
particles do not obscure each other but just add
more light to a given pixel - It also eliminates shadows
30Fire Explosions
- Wlliam Reeves initially used the term "particle
system" to describe a method he used the movie,
Star Trek II The Wrath of Khan - The effect was that of a bomb exploding on the
surface of a planet and fire spreading out from
the point of impact to eventually engulf the
planet
Particle Systems A Technique for Modeling a
Class of Fuzzy Objects, W. T. Reeves, ACM
Transactions on Graphics, Vol. 2, No. 2, April
1983, Pages 91-108.
31Fire Explosions
- Each particle in this system was a single point
in space - The fire was represented by thousands of these
individual points
32Fire Explosions
- Typical polygonal rendering methods create
objects with straight edges, but representing the
fire by thousands of points gives the fire a
"fuzzy" shape - Reeves calls an object made up of particles a
fuzzy object
33Waterfalls
- A water drop on top of the water fall has a
horizontal velocity (v1) due to the flow speed of
the river the vertical speed v2 is zero - When the water drop reaches the lake, all the
potential energy it had on top is converted into
kinetic energy it's vertical speed v2' is then
sqrt(2gh)? - The horizontal speed is almost constant during
the fall, so for all practical purposes you can
keep this velocity constant
34Fountains
- Water drops rise with a certain initial speed v1
that decreases continuously due to gravity - At it's highest point, where it's vertical speed
becomes zero, gravity takes over just as for a
waterfall - The horizontal speed doesn't come from pressure
induced velocity, but from the speed due to the
nozzle at the end of the pipe.
35Fireworks
- The velocity of the rocket is determined by the
initial velocity reduced by the influence of
gravity - When the rocket explodes, each partical gets a
velocity component which is directed away from
the explosion
36Tree Rendering Technique
- The particles of the trees are small circles used
to represent leaves and lines used to represent
branches - Because of the large number of particles,
standard lighting and shadow calculations are
computationally prohibitive, so more reasonable
solutions must be made.
37Self Shadowing
- Particles on the outside of the tree are more
likely to be directly illuminated then points on
the inside of the tree due to the self shadowing
of the tree - To model this, a lighting model is used where a
cone is used as the bounding volume for the tree - The distance from the point to the outside of the
bounding volume along the line between the point
and the light source is used as a parameter to
the lighting equation - The lighting equation has a maximum value at the
outer edge of the bounding volume facing the
light, and decreases exponentially inside the
tree - The previously mentioned distance parameter is
used as the exponent in this equation
38Ambient Lighting
- Ambient lighting is based on an equation similar
to the self shadowing equation - Since ambient light is not based on direct
illumination from a light source the distance
metric is made from the point being illuminated
horizontally out to the edge of the bounding
volume.
39External Shadowing
- In addition to shadows cast by the tree on
itself, shadows cast from neighboring trees must
be considered - This is accomplished by tracing a line from the
top of each neighboring tree to the light source. - When a particle is being rendered it is checked
to see if it is above or below this line - Points above this line are not shadowed, and
points below this line have a chance of being in
shadow that increases in proportion to the
distance from the line.
40External Shadowing
- For the same reasons that shadows could not be
perfectly generated for particles within the
trees, the shadows that the trees cast on the
ground must also be approximated - The way this was done was by rendering an image
of the trees from a viewpoint on the ground - This image was then texture mapped to the ground
as a "shadow map" - Points in the image that correspond to trees were
rendered as though they were in shadow
41Rendering
- The actual rendering algorithm used to draw the
trees was a modified painter's algorithm - The first assumption used by this algorithm is
that the bounding volumes of no two trees
intersect, so each tree could be rendered
independently - This cuts down on the number of particles that
have to be loaded simultaneously
42Rendering
- In addition, instead of simply depth sorting the
particles, they are placed in a number of depth
sorted bins - Inside each bin the particles are simply rendered
in order - This saves time because an exhaustive sort of all
particles does not have to be made - Errors caused by rendering particles in order
inside the bin are masked by the large number of
particles
43Flocking Birds
- Craig Reynolds used particle systems to model the
behavior of birds moving in a flock - In this particlesystem the particles are used
to represent "boids" (short for bird-object)?
Reynolds, C. W. (1987) Flocks, Herds, and
Schools A Distributed Behavioral Model, in
Computer Graphics, 21(4) (SIGGRAPH '87 Conference
Proceedings) pages 25-34.
44Flocking Birds
- This use of a particle system has a few
differences from what was used by Reeves - Each boid is an entire polygonal object rather
than a graphical primitive - Each boid has a local coordinate system
- There are a fixed number of boids - they are not
created or destroyed - Traditional rendering methods can be used because
there are a small number of boids - Boids behavior is dependent on external as well
as internal state. In other words, a boid reacts
to what other boids are doing around it.
45Boid Behavior Model
- Reynolds used observation of real flocks and
research of flock behavior to come up with three
primary needs of a boid - Collision avoidance (Separation)?
- Velocity matching (Alignment)?
- Flock centering (Cohesion)?
46Collision avoidance (Separation)?
- The boid does not wish to collide with other
boids or obstacles
47Velocity matching (Alignment)?
- Each boid attempts to go the same speed and
direction as neighboring boids
48Flock centering (Cohesion)?
- Each boid attempts to stay close to nearby
flockmates.
49Boid Behavior Model
- The boid's movement is made by combining the
impulses that are generated from these three
needs - If each need produces a vector that represents
the direction and speed it thinks the boid should
move in, it may not be adequate to simply average
these vectors - In the worst case, these three vectors may be
pointing in completely divergent directions, and
the net movement would be zero
50Applications
- Flocking
- Schools
- Herds
- People