Upload
dotuyen
View
216
Download
0
Embed Size (px)
Citation preview
Particle Systems
• Definition: Simulation of a set of similar, moving agents in a larger environment
• Scale usually such that aggregate motion of “swarm” is more apparent than internal agent motion
• Applications – Water, snow – Smoke, fire – Cloth – “Creatures”
• Basic loop: 1. Create, kill particles 2. Update positions based on:
• Previous positions, velocities, accelerations • Exterior and interior forces
3. Render particles
Fire: Each particle is a blended sprite
courtesy of S. Dunn
Particle/Agent Motion Factors • Global exterior forces such as gravity,
wind, pre-determined path, target position, etc.
• Interactions with fixed environment – Collisions – Friction
• Physical interactions with each other – Gravity, electrical attraction/repulsion – Spring connections – Collisions
• Interior “self determination” – Randomness – AI-like perception-action feedback
• Flocking, seeking with collision avoidance, etc.
Initial upward and outward velocity + gravity = water fountain
court
esy
of
Bla
ck B
elt S
yst
em
s
Smoke movie (turbulence…): Convection + invisible container =
smoke in a bottle
Particle Systems: Example
• Multiple “force phases”: 1. Pre-computed positions (e.g.,
face shape “attracts” particles to it)
2. Gravity as particles drop
3. Collision with plane to make them bounce
4. Wind vortex (not clear if this is physical simulation or just a 3-D surface with rotation)
5. Randomness as particles “buzz”
6. Back to face
from K. Sims movie “Particle Dreams” (1988)
Play particle75_1_89.mov
Particle Systems at the Movies
• First notable use (and coinage of name) was by W. Reeves in “Star Trek II: Wrath of Khan” (1982) for the “Genesis” effect
Particle are created, they move, and then go extinct (so the effect is localized) http://www.youtube.com/watch?v=QXbWCrzWJo4
Particle Systems at the Movies
“XXX” (2002) Avalanche effect by Digital Domain ~150,000 particles with matchmove
http://www.youtube.com/watch?v=5lWqNMC6YRs [~3:15 in]
Flocking with Interior Motion: Example
(Not the same algorithm as the Reynolds paper)
courtesy of D. Brogan
Flocking (C. Reynolds, SIGGRAPH 1987)
• Particles for simulating simple creatures: boids – Birds in flock – Fish in school – Etc.
• Not passive—forces are internally generated – Can be combined with external forces
• “Intentions” of each boid depend on characteristics of local environment
from C. Reynolds
Flocking: Local Environment
• Simulating vision in “murky water”, each boid only influenced by boids in neighborhood:
– Detection distance less than some threshold
– Angle from heading within peripheral vision range
courtesy of C. Reynolds
Boid Flocking Behaviors
• Basic (in priority order) – Collision Avoidance: Steer away
from too-close flockmates/obstacles
– Velocity Matching: Align direction and speed with nearby flockmates
– Flock Centering: Attempt to stay close to nearby flockmates
• More control: – Have leader(s) that don’t follow rules
above trace spline path to “guide” things
– Randomness and awareness of fixed obstacles in environment
courtesy of C. Reynolds
Collision avoidance
Velocity matching
Centering
Flocking Behaviors: Details
• Each behavior generates an acceleration a(t) directly (no consideration of mass)
• Electric charge-like model is followed: – Attractions and repulsions allowed
– Magnitude of induced acceleration falls off with inverse square of distance (0 outside neighborhood)
• Component accelerations are combined with weights for “personality” control: a(t) = wavoidaavoid(t) + wmatchamatch(t) + wcenteracenter(t)
Flocking examples: What’s Involved Here?
CrowdMaker Maya plugin (test_1000, test_Crowd) Environment awareness, leader
court
esy
of
C.
Reynold
s
court
esy
of
A.
Rin
ald
i
PSCrowd (demo for PS3; 5,000 fish: fishHiRes) Inverse kinematics?
Advanced Flocking at the Movies
courtesy of massivesoftware.com
“The Two Towers” (2002) Soldiers in battle scenes are articulated particles that each run small AI program to guide motion, actions http://www.youtube.com/watch?v=Rn6suNh5Gn0 (2:00-3:00) Play egyptbattle, weta-kong
courtesy of lordoftherings.net
Particle Systems: Steps
1. Create new particles and initialize their states
– Position, velocity, etc.
2. Delete “expired” particles
3. Update particle states based on forces both physical & virtual
4. Render particles
Particle Creation and Deletion
• Creation: Where? – Fixed source—e.g., fountain, top of waterfall
– Low density areas (to ensure adequate coverage)
– On object surface
– Along user-designated curve
• Deletion: Why? – Fixed lifetime ended
– Left bounding box
– Local density over threshold (e.g., have enough already for realistic effect)
Particle Update
• Given particle state at time t consisting of position, velocity, etc., how do we compute new values at time x(t + Δt) ?
• Typically, we don’t have an explicit parametric function x(t) that we can just evaluate for any t – E.g., a spline curve
• Rather, we have a set of forces and an initial value for the particle state
• We have to simulate the action of the forces on the particle to “see what happens”!
Forces
• Unary: “Global” forces applied to particles independently – Gravity: Can regard as constant acceleration in downward
direction:
fgravity(t) = m g
– Drag: Resistance to motion through medium proportional to speed:
fdrag(t) = -kd v(t)
• n-ary: Interaction forces between particles – Gravitational attraction – Electrical charge – Springs
Based on proximity
Specific to connected particles
n-ary Forces: Springs
• 2 connected particles a and b exert force on one another proportional to displace-ment from resting length r of spring
• Assuming time t, let Δx = xa – xb , d = Δx/|Δx|, and Δv = va – vb . Then the force on a is (where fb = –fa):
spring constant (“stiffness”)
damping constant (like “spring drag”)
a b
See molecule examples at http://www.myphysicslab.com
Collisions
• Penalty method – Spring-like force
proportional to penetration distance pushes particle out of object interior
• Hard collisions – Detect intersection point explicitly, treat
like a reflection (note that initial velocity vector points toward surface):
See collision examples (with many more tips) at http://www.myphysicslab.com
Spring systems
• Networks of particles connected by springs can be used to simulate objects with elastic properties – 1-D: Rope, hair, grass
– 2-D: Cloth
– 3-D: Deformable (aka rubber) objects
Spring networks for cloth Angular springs for hair: Stiffness More “body”
court
esy
of
M. Kass
court
esy
of
J. B
arb
ic
Squishy “jello”
Hair examples
court
esy
of
A.
Selle
No hair-hair adhesion: Basically like thin ropes
With “stiction”: A bit like wet hair--sticky
Deformable 3-D objects: “Jello cube”
http://www.youtube.com/watch?v=qWJ6mgkOF-c