particle systems - university of...
TRANSCRIPT
![Page 1: Particle Systems - University of Edinburghhomepages.inf.ed.ac.uk/tkomura/cav/presentation10_2013.pdf · 2013-02-15 · particle system For each frame of an animation sequence the](https://reader033.vdocuments.us/reader033/viewer/2022060410/5f1069347e708231d448f9f0/html5/thumbnails/1.jpg)
Particle Systems
Computer Animation and Visualisation
Lecture 10
Taku Komura
![Page 2: Particle Systems - University of Edinburghhomepages.inf.ed.ac.uk/tkomura/cav/presentation10_2013.pdf · 2013-02-15 · particle system For each frame of an animation sequence the](https://reader033.vdocuments.us/reader033/viewer/2022060410/5f1069347e708231d448f9f0/html5/thumbnails/2.jpg)
Overview
• Particle System – Modelling fuzzy objects
– Modelling fire
– Modelling liquid
– Modelling cloth, hair
– Integration : – Euler
– Verlet integration
– implicit integration,
– Rigid body dynamics by particle systems
![Page 3: Particle Systems - University of Edinburghhomepages.inf.ed.ac.uk/tkomura/cav/presentation10_2013.pdf · 2013-02-15 · particle system For each frame of an animation sequence the](https://reader033.vdocuments.us/reader033/viewer/2022060410/5f1069347e708231d448f9f0/html5/thumbnails/3.jpg)
Particle Systems
• Modelling objects by a number of small particles
• We can model fuzzy objects such as – fire,
– fireworks
– clouds,
– smoke,
– water, etc.
• But we can also model
– cloth
– hair
– rigid objects
![Page 4: Particle Systems - University of Edinburghhomepages.inf.ed.ac.uk/tkomura/cav/presentation10_2013.pdf · 2013-02-15 · particle system For each frame of an animation sequence the](https://reader033.vdocuments.us/reader033/viewer/2022060410/5f1069347e708231d448f9f0/html5/thumbnails/4.jpg)
Particle System
• Initially developed by Reeves to create scenes for Star Trek II.
http://www.youtube.com/watch?v=13b7TSiidaM&feature=channel_page
Reeves ’83,’85
![Page 5: Particle Systems - University of Edinburghhomepages.inf.ed.ac.uk/tkomura/cav/presentation10_2013.pdf · 2013-02-15 · particle system For each frame of an animation sequence the](https://reader033.vdocuments.us/reader033/viewer/2022060410/5f1069347e708231d448f9f0/html5/thumbnails/5.jpg)
Particle Dynamics
• A particle's position in
each succeeding frame
can be computed by
its velocity
• This can be modified
by an acceleration
force for more complex
movements, e.g.,
gravity simulation.
xnew
=xold
+voldΔt
vnew
=vold+aΔt
ma=F
![Page 6: Particle Systems - University of Edinburghhomepages.inf.ed.ac.uk/tkomura/cav/presentation10_2013.pdf · 2013-02-15 · particle system For each frame of an animation sequence the](https://reader033.vdocuments.us/reader033/viewer/2022060410/5f1069347e708231d448f9f0/html5/thumbnails/6.jpg)
Particle Attributes
Each new particle has the following
attributes:
– initial position
– initial velocity (speed and direction)
– initial size
– initial color
– initial transparency
– shape
– lifetime
![Page 7: Particle Systems - University of Edinburghhomepages.inf.ed.ac.uk/tkomura/cav/presentation10_2013.pdf · 2013-02-15 · particle system For each frame of an animation sequence the](https://reader033.vdocuments.us/reader033/viewer/2022060410/5f1069347e708231d448f9f0/html5/thumbnails/7.jpg)
Modelling fuzzy objects with
particle system For each frame of an animation sequence the following
steps are performed:
1. New particles are generated
2. Each new particle is assigned its own set of attributes
3. Any particles that have existed for a predetermined time are destroyed
4. The remaining particles are transformed and moved according to their dynamic attributes
5. An image of the remaining particles is rendered
![Page 8: Particle Systems - University of Edinburghhomepages.inf.ed.ac.uk/tkomura/cav/presentation10_2013.pdf · 2013-02-15 · particle system For each frame of an animation sequence the](https://reader033.vdocuments.us/reader033/viewer/2022060410/5f1069347e708231d448f9f0/html5/thumbnails/8.jpg)
Spawning Particles
• Particles are generated using stochastic
methods.
• The designer controls the mean number and
variance.
• number of particles generated :
−1.0≤rand()≤1.0
N partsF =Nmean +rand ()⋅Variance
a uniformly distributed random number
![Page 9: Particle Systems - University of Edinburghhomepages.inf.ed.ac.uk/tkomura/cav/presentation10_2013.pdf · 2013-02-15 · particle system For each frame of an animation sequence the](https://reader033.vdocuments.us/reader033/viewer/2022060410/5f1069347e708231d448f9f0/html5/thumbnails/9.jpg)
Modelling Fire
- Define an emitter circle
- The particles are launched in a random direction within a predefined range
𝒙 = 𝒙𝒎𝒆𝒂𝒏 + 𝑟𝑎𝑛𝑑() × 𝒙𝒗𝒂𝒓
𝒗 = 𝒗𝒎𝒆𝒂𝒏 + 𝑟𝑎𝑛𝑑() × 𝒗𝒗𝒂𝒓
![Page 10: Particle Systems - University of Edinburghhomepages.inf.ed.ac.uk/tkomura/cav/presentation10_2013.pdf · 2013-02-15 · particle system For each frame of an animation sequence the](https://reader033.vdocuments.us/reader033/viewer/2022060410/5f1069347e708231d448f9f0/html5/thumbnails/10.jpg)
Modelling Fire (2)
- Forces are added to the particles such that they move towards the goal position
- The goal is controlled randomly to add wobbling effect
goal[0][0] = 7*sin(rand()%360*PI/180); goal[0][2] = 7*cos(rand()%360*PI/180); goal[0][1] = getRandomValue(25,5);
https://www.youtube.com/watch?v=7LbtpmFSKF4&list=UU0ITEfzrLiblxtsImEfE08w&index=3
![Page 11: Particle Systems - University of Edinburghhomepages.inf.ed.ac.uk/tkomura/cav/presentation10_2013.pdf · 2013-02-15 · particle system For each frame of an animation sequence the](https://reader033.vdocuments.us/reader033/viewer/2022060410/5f1069347e708231d448f9f0/html5/thumbnails/11.jpg)
Modelling Fire (3)
- The color is adjusted such that they are bright when close to the centre and darker when farther away
http://www.youtube.com/watch?NR=1&feature=endscreen&v=gS_koVukVzE
![Page 12: Particle Systems - University of Edinburghhomepages.inf.ed.ac.uk/tkomura/cav/presentation10_2013.pdf · 2013-02-15 · particle system For each frame of an animation sequence the](https://reader033.vdocuments.us/reader033/viewer/2022060410/5f1069347e708231d448f9f0/html5/thumbnails/12.jpg)
Modelling Water • To model liquid, the interactions between the
particles must be taken into account
• Interactions produce forces
• Three kinds of forces – adhesion forces
– viscosity forces
– friction forces
![Page 13: Particle Systems - University of Edinburghhomepages.inf.ed.ac.uk/tkomura/cav/presentation10_2013.pdf · 2013-02-15 · particle system For each frame of an animation sequence the](https://reader033.vdocuments.us/reader033/viewer/2022060410/5f1069347e708231d448f9f0/html5/thumbnails/13.jpg)
Adhesion Force Attract particles to each other and to other
objects
The adhesion force between (left) honey-honey, (middle)
honey-ceramic and (right) non-mixing liquid
![Page 14: Particle Systems - University of Edinburghhomepages.inf.ed.ac.uk/tkomura/cav/presentation10_2013.pdf · 2013-02-15 · particle system For each frame of an animation sequence the](https://reader033.vdocuments.us/reader033/viewer/2022060410/5f1069347e708231d448f9f0/html5/thumbnails/14.jpg)
Viscosity Force
• Limit shear movement of particles in the liquid
• The momentum between the neighbour particles
are exchanged
Pp Ppn
Pexch
=v⋅k (d
pn)( P
p−P
pn)Δt
2∑n=1
nk (d i)
v : viscosity coefficient
k () : A weighting function (Gaussian )
di: distance from the processed particle
Pp
,Ppn
: momentum of p and pn
Pexch
: momentum exchanced
Pp=P
p+P
exch
Ppn=P
pn−P
exch
![Page 15: Particle Systems - University of Edinburghhomepages.inf.ed.ac.uk/tkomura/cav/presentation10_2013.pdf · 2013-02-15 · particle system For each frame of an animation sequence the](https://reader033.vdocuments.us/reader033/viewer/2022060410/5f1069347e708231d448f9f0/html5/thumbnails/15.jpg)
Friction Force
– Dampen movement of particles in contact with objects in
the environment.
– Simply scale down the velocity by a constant value
– Or we can compute the penetration depth, and adjust the
force according to the depth (explained later)
vv f=ˆ
![Page 16: Particle Systems - University of Edinburghhomepages.inf.ed.ac.uk/tkomura/cav/presentation10_2013.pdf · 2013-02-15 · particle system For each frame of an animation sequence the](https://reader033.vdocuments.us/reader033/viewer/2022060410/5f1069347e708231d448f9f0/html5/thumbnails/16.jpg)
Rendering liquid • There are two categories of methods for rendering liquid
– rendering individual particles, or
– rendering the surface of the entire liquid
• Rendering individual particles works well for modelling waterfalls or spray
• A surface rendering will give a more accurate description but is generally much slower
http://www.youtube.com/watch?v=n5lOjME8B6M http://www.youtube.com/watch?v=isXNkTiiAYQ
![Page 17: Particle Systems - University of Edinburghhomepages.inf.ed.ac.uk/tkomura/cav/presentation10_2013.pdf · 2013-02-15 · particle system For each frame of an animation sequence the](https://reader033.vdocuments.us/reader033/viewer/2022060410/5f1069347e708231d448f9f0/html5/thumbnails/17.jpg)
Rendering Liquid by Blobs (metaballs)
• Create an implicit function similar to the electron density maps
• We can define the surface where F(x,y,z)=0 Blinn ‘92
D ( x , y , z )=∑i
biexp(−a
ir
i)
r i=√( x− xi )2+( y− y i )
2+( z−zi )
2
( xi, y
i, z
i) : the center of the particle i
F ( x , y , z )=D ( x , y , z )−T
![Page 18: Particle Systems - University of Edinburghhomepages.inf.ed.ac.uk/tkomura/cav/presentation10_2013.pdf · 2013-02-15 · particle system For each frame of an animation sequence the](https://reader033.vdocuments.us/reader033/viewer/2022060410/5f1069347e708231d448f9f0/html5/thumbnails/18.jpg)
Advantages of simulating fuzzy
objects by particle systems
• Complex systems can be created with little
human effort.
• The level of detail can be easily adjusted.
– 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)
![Page 19: Particle Systems - University of Edinburghhomepages.inf.ed.ac.uk/tkomura/cav/presentation10_2013.pdf · 2013-02-15 · particle system For each frame of an animation sequence the](https://reader033.vdocuments.us/reader033/viewer/2022060410/5f1069347e708231d448f9f0/html5/thumbnails/19.jpg)
Level-of-Detail
– A particle in low resolution can correspond to a
set of particles in high resolution
– The position and velocity of the particle in low
resolution becomes the means of the positions
and velocities of the high resolution set
![Page 20: Particle Systems - University of Edinburghhomepages.inf.ed.ac.uk/tkomura/cav/presentation10_2013.pdf · 2013-02-15 · particle system For each frame of an animation sequence the](https://reader033.vdocuments.us/reader033/viewer/2022060410/5f1069347e708231d448f9f0/html5/thumbnails/20.jpg)
Cloth Simulation
• Need to generate animations of cloth of the
characters appearing in the games
• Can use particles for this purpose
![Page 21: Particle Systems - University of Edinburghhomepages.inf.ed.ac.uk/tkomura/cav/presentation10_2013.pdf · 2013-02-15 · particle system For each frame of an animation sequence the](https://reader033.vdocuments.us/reader033/viewer/2022060410/5f1069347e708231d448f9f0/html5/thumbnails/21.jpg)
Cloth
• We model the cloth by mass-spring
models (particles connected with
springs)
– Mass pulled by the interconnecting
springs
![Page 22: Particle Systems - University of Edinburghhomepages.inf.ed.ac.uk/tkomura/cav/presentation10_2013.pdf · 2013-02-15 · particle system For each frame of an animation sequence the](https://reader033.vdocuments.us/reader033/viewer/2022060410/5f1069347e708231d448f9f0/html5/thumbnails/22.jpg)
Hair
• Linear set of particles
• Length structural force
• Deformation forces proportional to the angle between segments
http://www.youtube.com/watch?v=gj2UdZ-G0vg&feature=related
![Page 23: Particle Systems - University of Edinburghhomepages.inf.ed.ac.uk/tkomura/cav/presentation10_2013.pdf · 2013-02-15 · particle system For each frame of an animation sequence the](https://reader033.vdocuments.us/reader033/viewer/2022060410/5f1069347e708231d448f9f0/html5/thumbnails/23.jpg)
Integration for Simulation
• Computing the new position and velocity
from the current ones using the force
Three ways of integration
• Euler
• Verlet
• Implicit Integration
),(
),(
00
00
vxg
vxf
v
x
![Page 24: Particle Systems - University of Edinburghhomepages.inf.ed.ac.uk/tkomura/cav/presentation10_2013.pdf · 2013-02-15 · particle system For each frame of an animation sequence the](https://reader033.vdocuments.us/reader033/viewer/2022060410/5f1069347e708231d448f9f0/html5/thumbnails/24.jpg)
Integration for Simulation
Euler Method
• ∆t : time step
• M : mass matrix,
• fo : external force
• ∆x ∆v position, velocity updates of particles
• xo vo , current position, velocity
0
1f
v
Δv
Δx 0
M
Δt=
![Page 25: Particle Systems - University of Edinburghhomepages.inf.ed.ac.uk/tkomura/cav/presentation10_2013.pdf · 2013-02-15 · particle system For each frame of an animation sequence the](https://reader033.vdocuments.us/reader033/viewer/2022060410/5f1069347e708231d448f9f0/html5/thumbnails/25.jpg)
Problem with Euler Method
• When the time step is too large, the
system can blow up (diverge) very
quickly
![Page 26: Particle Systems - University of Edinburghhomepages.inf.ed.ac.uk/tkomura/cav/presentation10_2013.pdf · 2013-02-15 · particle system For each frame of an animation sequence the](https://reader033.vdocuments.us/reader033/viewer/2022060410/5f1069347e708231d448f9f0/html5/thumbnails/26.jpg)
Verlet integration (Jakobsen ’02)
Directly computing the next position from the acceleration
• x0 : current position
• x’ : updated position
• x*: The position in the previous step
• Δt : time step,
• a : acceleration
• Used intensely when simulating molecular dynamics. It is quite stable
since the velocity is implicitly given
• Directly computing the next location from the current acceleration
0
2
02
xx
axxx'
*
*
=
t+=
![Page 27: Particle Systems - University of Edinburghhomepages.inf.ed.ac.uk/tkomura/cav/presentation10_2013.pdf · 2013-02-15 · particle system For each frame of an animation sequence the](https://reader033.vdocuments.us/reader033/viewer/2022060410/5f1069347e708231d448f9f0/html5/thumbnails/27.jpg)
Implicit Integration (Baraff ’98)
• Very stable
• Assuming the force in the next time step
also results in the velocity increment at
this time step
• Need to calculate ∆𝒙, ∆𝒗 that satisfies this
equation
)++(M
+Δt=
ΔvvΔx,xf
Δvv
Δv
Δx
00
0
1
Type equation here.
![Page 28: Particle Systems - University of Edinburghhomepages.inf.ed.ac.uk/tkomura/cav/presentation10_2013.pdf · 2013-02-15 · particle system For each frame of an animation sequence the](https://reader033.vdocuments.us/reader033/viewer/2022060410/5f1069347e708231d448f9f0/html5/thumbnails/28.jpg)
Taylor series expansion of the force
• Substituting this into the last equation,
we get
)++(M
+vΔt=
Δvv
fΔx
x
ff
Δv
Δv
Δx
0
1
0
![Page 29: Particle Systems - University of Edinburghhomepages.inf.ed.ac.uk/tkomura/cav/presentation10_2013.pdf · 2013-02-15 · particle system For each frame of an animation sequence the](https://reader033.vdocuments.us/reader033/viewer/2022060410/5f1069347e708231d448f9f0/html5/thumbnails/29.jpg)
Finally, computing the velocity
update
• Substituting
We can finally compute by
x
f
v
f
v
Δv0
121
0
1
MΔtΔtMI
x
fΔt+fΔtM
=
)+Δt(= ΔvvΔx 0
![Page 30: Particle Systems - University of Edinburghhomepages.inf.ed.ac.uk/tkomura/cav/presentation10_2013.pdf · 2013-02-15 · particle system For each frame of an animation sequence the](https://reader033.vdocuments.us/reader033/viewer/2022060410/5f1069347e708231d448f9f0/html5/thumbnails/30.jpg)
Advantages
• We can update by using large time
steps ( )
• Do not have to worry about blowing off
• The motions can be smoothened too much
Drawbacks
ΔvΔx,tΔ
![Page 31: Particle Systems - University of Edinburghhomepages.inf.ed.ac.uk/tkomura/cav/presentation10_2013.pdf · 2013-02-15 · particle system For each frame of an animation sequence the](https://reader033.vdocuments.us/reader033/viewer/2022060410/5f1069347e708231d448f9f0/html5/thumbnails/31.jpg)
Advanced Character Physics (ACP):
Multibody dynamics by particle system
Jakobsen, GDC `02
• Simulating articulated objects such as
human bodies, robotic arms, cars by
particle systems
• easy to implement
• But slow when the particle number is very
large
![Page 32: Particle Systems - University of Edinburghhomepages.inf.ed.ac.uk/tkomura/cav/presentation10_2013.pdf · 2013-02-15 · particle system For each frame of an animation sequence the](https://reader033.vdocuments.us/reader033/viewer/2022060410/5f1069347e708231d448f9f0/html5/thumbnails/32.jpg)
ACP: How does it work?
• Model rigid bodies by a collection of particles
• Assume the distance between the particles will
remain the same if they belong to the rigid body
• Each particle will move based on the free particle
dynamics
• The 3D position will be modified according to the
distance constraints
![Page 33: Particle Systems - University of Edinburghhomepages.inf.ed.ac.uk/tkomura/cav/presentation10_2013.pdf · 2013-02-15 · particle system For each frame of an animation sequence the](https://reader033.vdocuments.us/reader033/viewer/2022060410/5f1069347e708231d448f9f0/html5/thumbnails/33.jpg)
ACP: Keeping the distance
between the particles the same
• The two particles are simply translated along the
line connecting them offline
• The traveling distance is inverse proportional to the
mass
![Page 34: Particle Systems - University of Edinburghhomepages.inf.ed.ac.uk/tkomura/cav/presentation10_2013.pdf · 2013-02-15 · particle system For each frame of an animation sequence the](https://reader033.vdocuments.us/reader033/viewer/2022060410/5f1069347e708231d448f9f0/html5/thumbnails/34.jpg)
Algorithm
1. Move the particles as free particles by physics - Verlet integration
2. For each bone Move each particle inverse proportional to their mass (as explained in last page)
3. Repeat 2 a few times until the all the distance constraints are satisfied
4. Go back to 1
![Page 35: Particle Systems - University of Edinburghhomepages.inf.ed.ac.uk/tkomura/cav/presentation10_2013.pdf · 2013-02-15 · particle system For each frame of an animation sequence the](https://reader033.vdocuments.us/reader033/viewer/2022060410/5f1069347e708231d448f9f0/html5/thumbnails/35.jpg)
ACP: Modeling joints
It is possible to connect multiple rigid
bodies by hinges, pin joints, and so on.
Simply let two rigid bodies share a
particle, and they will be connected by a
pin joint. Share two particles, and they
are connected by a hinge.
A 3DOF pin joint (left) and 1DOF hinge
joint (right)
![Page 36: Particle Systems - University of Edinburghhomepages.inf.ed.ac.uk/tkomura/cav/presentation10_2013.pdf · 2013-02-15 · particle system For each frame of an animation sequence the](https://reader033.vdocuments.us/reader033/viewer/2022060410/5f1069347e708231d448f9f0/html5/thumbnails/36.jpg)
ACP: Setting joint limits
• A method for restraining angles is to satisfy a dot
product constraint
• Insert a virtual bone between the mass points
temporarily
(x2−x0 )⋅(x1−x0 )<α .
![Page 37: Particle Systems - University of Edinburghhomepages.inf.ed.ac.uk/tkomura/cav/presentation10_2013.pdf · 2013-02-15 · particle system For each frame of an animation sequence the](https://reader033.vdocuments.us/reader033/viewer/2022060410/5f1069347e708231d448f9f0/html5/thumbnails/37.jpg)
ACP: Modeling Characters
• We can model human characters by this system
• Used for ragdoll physics in Hitman
• http://www.teknikus.dk/tj/gdc2001.htm
• Can apply for inverse kinematics
Figure 9. The particle/stick configuration used in Hitman for representing the human anatomy
![Page 38: Particle Systems - University of Edinburghhomepages.inf.ed.ac.uk/tkomura/cav/presentation10_2013.pdf · 2013-02-15 · particle system For each frame of an animation sequence the](https://reader033.vdocuments.us/reader033/viewer/2022060410/5f1069347e708231d448f9f0/html5/thumbnails/38.jpg)
ACP: Collision detection
• The collision detection will
be done based on the points
and the surfaces
• The colliding particle will be
pushed out from the
penetrating area
• The velocity element of the
colliding particle
perpendicular to the surface
will be reduced to zero
![Page 39: Particle Systems - University of Edinburghhomepages.inf.ed.ac.uk/tkomura/cav/presentation10_2013.pdf · 2013-02-15 · particle system For each frame of an animation sequence the](https://reader033.vdocuments.us/reader033/viewer/2022060410/5f1069347e708231d448f9f0/html5/thumbnails/39.jpg)
How to resolve collisions?
• Find the closest face among all the faces
• Move the particle in the direction of the normal vector of the closest face
![Page 40: Particle Systems - University of Edinburghhomepages.inf.ed.ac.uk/tkomura/cav/presentation10_2013.pdf · 2013-02-15 · particle system For each frame of an animation sequence the](https://reader033.vdocuments.us/reader033/viewer/2022060410/5f1069347e708231d448f9f0/html5/thumbnails/40.jpg)
ACP: Friction Force
• According to the Coulomb friction model,
friction force depends on the size of the
normal force between the objects in contact.
• The penetration depth dp can be first
measured when a penetration has occured
(before projecting the penetration point out of
the obstacle),
• and then, the tangential velocity vt is then
reduced by an amount proportional to dp (the
proportion factor being the friction constant).
![Page 41: Particle Systems - University of Edinburghhomepages.inf.ed.ac.uk/tkomura/cav/presentation10_2013.pdf · 2013-02-15 · particle system For each frame of an animation sequence the](https://reader033.vdocuments.us/reader033/viewer/2022060410/5f1069347e708231d448f9f0/html5/thumbnails/41.jpg)
Readings • Blinn, “A Generalization of Algebraic Surface Drawing” ACM
Transactions on Graphics, 1982
• Baraff and Witkin, “Large Steps in Cloth Simulation”, SIGGRAPH 98
• Jakobsen, “Advanced Character Physics”, GDC02
• Stam, “Stable Fluids”, SIGGRAPH 99
• M. Lin and J. Canny, IEEE Conference on Robotics and Automation, pages 1008-1014, 1991
• W. T. Reeves, "Particle Systems - A Technique for Modeling a Class of Fuzzy Objects", Computer Graphics, vol. 17, no. 3, pp 359-376, 1983.
• W. T. Reeves, "Approximate and Probabilistic Algorithms for Shading and Rendering Structured Particle Systems", Computer Graphics, vol. 19, no. 3, pp 313-322, 1985.
Implementing Particle System to Simulate Fire and Water Effects Ankit Chaudhari, Pradeep Singh, Puneet Kalra