Basics of Particle Systems
Types of Animation
►Keyframing
►Procedural
►Physically-based
►Particle Systems
►Continuum Mechanics (fluids, etc.), finite
elements
►Rigid body simulation
Types of Animation
►Keyframing
►Procedural
►Physically-based
►Particle Systems
►Continuum Mechanics (fluids, etc.), finite
elements
►Rigid body simulation
Types of Animation: Physically-Based
► Assign physical properties to objects
►Masses, forces, etc.
► Procedural forces (like wind)
► Simulate physics by solving equations of motion
►Rigid bodies, fluids, plastic deformation, etc.
► Realistic but difficult to control
v0
Keating from Pexels
m g
Photo by George
Types of Dynamics
► Points
Types of Dynamics
► Points
► Rigid body
Types of Dynamics
► Points
► Rigid body
► Deformable body
(include clothes, fluids, smoke, etc.)
Mark Carlson
We Focus on Point Dynamics
► Lots of points!
► Particles systems
►Borderline between procedural and
physically-based
Unity Particle Pack
https://youtu.be/mAHIKxu7pnw
Outline
► Particle Systems Overview
► Simple Particle System
►Algorithm
►Math (Solving ODE)
Outline
► Particle Systems Overview
► Simple Particle System
►Algorithm
►Math (Solving ODE)
Particle Systems Overview
► Emitters generate tons of “particles”
Sprinkler Waterfall Chimney
Image Jeff Lander
Particle Systems Overview
► Emitters generate tons of “particles”
Emitter
Emitter
Emitter
Image Jeff Lander
Particle Systems Overview
► Emitters generate tons of “particles”
► Describe the external forces with a force field
Gravity
Wind
Wind
Image Jeff Lander
Particle Systems Overview
► Emitters generate tons of “particles”
► Describe the external forces with a force field
► Integrate the laws of mechanics (ODEs)
►Makes the particles move
v0
m g
Particle Systems Overview
► Emitters generate tons of “particles”
► Describe the external forces with a force field
► Integrate the laws of mechanics (ODEs)
► In the
simplest case, each particle is
independent
Particle Systems Overview
► Emitters generate tons of “particles”
► Describe the external forces with a force field
► Integrate the laws of mechanics (ODEs)
► In the
simplest case, each particle is
independent
Photo by Fancycrave.com from Pexels
► If there
is enough randomness (in particular at
the emitter) you get nice effects
►sand, dust, smoke, sparks, flame, water, …
Photo by Hasan Albari from Pexels
https://youtu.be/heW3vn1hP2E
Sprinkler
http://www.youtube.com/watch?v=rhvH12nC6_Q
Fire
https://youtu.be/NiNJyTLG6qs
Particle Systems in Games
https://www.youtube.com/watch?v=hqMw4cI8e9c
Outline
► Particle Systems Overview
► Simple Particle System
►Algorithm
►Math (Solving ODE)
What is a Particle System?
► Collection of many small simple point-like things
►Described by their current state: position,
velocity, age, color, etc.
► Particle motion influenced by external force
fields and internal forces between particles
► Particles created by generators or emitters
►With some randomness
► Particles often have lifetimes
► Treat
as points for dynamics, but
rendered as anything you want
Simple Particle System: Sprinkler
PL: linked list of particle = empty;
Emitter (0, 0, 0)
Simple Particle System: Sprinkler
PL: linked list of particle = empty;
spread=0.1;//how random the initial velocity is
colorSpread=0.1; //how random the colors are
Emitter (0, 0, 0)
Simple Particle System: Sprinkler
PL: linked list of particle = empty;
spread=0.1;//how random the initial velocity is
colorSpread=0.1; //how random the colors are
For each time step
Emitter (0, 0, 0)
Simple Particle System: Sprinkler
PL: linked list of particle = empty;
spread=0.1;//how random the initial velocity is
colorSpread=0.1; //how random the colors are
For each time step
Generate k particles
p=new particle();
p->position=(0,0,0);
p->velocity=(0,0,1)+spread*(rnd(), rnd(), rnd());
p.color=(0,0,1)+colorSpread*(rnd(), rnd(),rnd());
PL->add(p);
1 1st group
Simple Particle System: Sprinkler
PL: linked list of particle = empty;
spread=0.1;//how random the initial velocity is
colorSpread=0.1; //how random the colors are
For each time step
Generate k particles
p=new particle();
p->position=(0,0,0);
p->velocity=(0,0,1)+spread*(rnd(), rnd(), rnd());
p.color=(0,0,1)+colorSpread*(rnd(), rnd(),rnd()); 11 1st group
PL->add(p); 1
For each particle p in PL
Emitter
p->position+=p->velocity*dt; //dt: time step
p->velocity-=g*dt; //g: gravitation constant
glColor(p.color);
glVertex(p.position);
Simple Particle System: Sprinkler
PL: linked list of particle = empty;
spread=0.1;//how random the initial velocity is
colorSpread=0.1; //how random the colors are
For each time step
Generate k particles
p=new particle();
p->position=(0,0,0);
p->velocity=(0,0,1)+spread*(rnd(), rnd(), rnd());
p.color=(0,0,1)+colorSpread*(rnd(), rnd(),rnd()); 11 1st group
PL->add(p); 1
For each particle p in PL
2 2nd group
p->position+=p->velocity*dt; //dt: time step
p->velocity-=g*dt; //g: gravitation constant
glColor(p.color);
glVertex(p.position);
Simple Particle System: Sprinkler
PL: linked list of particle = empty;
spread=0.1;//how random the initial velocity is
colorSpread=0.1; //how random the colors are
For each time step
Generate k particles
p=new particle();
p->position=(0,0,0); 1
1 1st group
p->velocity=(0,0,1)+spread*(rnd(), rnd(), rnd()); 12
p.color=(0,0,1)+colorSpread*(rnd(), rnd(),rnd());
2 2 2nd group
PL->add(p);
For each particle p in PL
Emitter
p->position+=p->velocity*dt; //dt: time step
p->velocity-=g*dt; //g: gravitation constant
glColor(p.color);
glVertex(p.position);
Simple Particle System: Sprinkler
PL: linked list of particle = empty;
spread=0.1;//how random the initial velocity is
colorSpread=0.1; //how random the colors are
For each time step
Generate k particles
p=new particle();
p->position=(0,0,0); 1
1 1st group
p->velocity=(0,0,1)+spread*(rnd(), rnd(), rnd()); 12
p.color=(0,0,1)+colorSpread*(rnd(), rnd(),rnd());
2 2 2nd group
PL->add(p);
For each particle p in PL
3 3rd group
p->position+=p->velocity*dt; //dt: time step
p->velocity-=g*dt; //g: gravitation constant
glColor(p.color);
glVertex(p.position);
Simple Particle System: Sprinkler
PL: linked list of particle = empty;
spread=0.1;//how random the initial velocity is
colorSpread=0.1; //how random the colors are
For each time step
Generate k particles 1
p=new particle(); 1 1st group
2
p->position=(0,0,0); 1
p->velocity=(0,0,1)+spread*(rnd(), rnd(), rnd()); 2 2 2nd group
p.color=(0,0,1)+colorSpread*(rnd(), rnd(),rnd());
3
PL->add(p); 3 3 3rd group
For each particle p in PL
Emitter
p->position+=p->velocity*dt; //dt: time step
p->velocity-=g*dt; //g: gravitation constant
glColor(p.color);
glVertex(p.position);
Simple Particle System: Sprinkler
PL: linked list of particle = empty;
spread=0.1;//how random the initial velocity is
colorSpread=0.1; //how random the colors are
For each time step
Generate k particles 1
p=new particle(); 1 1st group
2
p->position=(0,0,0); 1
p->velocity=(0,0,1)+spread*(rnd(), rnd(), rnd()); 2 2 2nd group
p.color=(0,0,1)+colorSpread*(rnd(), rnd(),rnd());
3
PL->add(p); 3 3 3rd group
For each particle p in PL
4 4th group
p->position+=p->velocity*dt; //dt: time step
p->velocity-=g*dt; //g: gravitation constant
glColor(p.color);
glVertex(p.position);
Simple Particle System: Sprinkler
PL: linked list of particle = empty;
spread=0.1;//how random the initial velocity is
colorSpread=0.1; //how random the colors are
For each time step
Generate k particles
1 2
1
p=new particle();
p->position=(0,0,0); 1
2 3 2
p->velocity=(0,0,1)+spread*(rnd(), rnd(), rnd());
3 3
p.color=(0,0,1)+colorSpread*(rnd(), rnd(),rnd()); 4
PL->add(p); 4 4 4th group
For each particle p in PL
Emitter
p->position+=p->velocity*dt; //dt: time step
p->velocity-=g*dt; //g: gravitation constant
glColor(p.color);
glVertex(p.position);
Simple Particle System: Sprinkler
PL: linked list of particle = empty;
spread=0.1;//how random the initial velocity is
colorSpread=0.1; //how random the colors are
For each time step
Generate k particles
1 2
1
p=new particle();
p->position=(0,0,0); 1
2 3 2
p->velocity=(0,0,1)+spread*(rnd(), rnd(), rnd());
3 3
p.color=(0,0,1)+colorSpread*(rnd(), rnd(),rnd()); 4
PL->add(p); 4 4 4th group
For each particle p in PL
5 5th group
p->position+=p->velocity*dt; //dt: time step
p->velocity-=g*dt; //g: gravitation constant
glColor(p.color);
glVertex(p.position);
Simple Particle System: Sprinkler
PL: linked list of particle = empty;
spread=0.1;//how random the initial velocity is
colorSpread=0.1; //how random the colors are
2
For each time step
Generate k particles 1
p=new particle();
1
p->position=(0,0,0); 4
13 3
p->velocity=(0,0,1)+spread*(rnd(), rnd(), rnd()); 2 5 32
p.color=(0,0,1)+colorSpread*(rnd(), rnd(),rnd()); 4 5
5
PL->add(p); 4
For each particle p in PL
p->position+=p->velocity*dt; //dt: time step
Emitter
p->velocity-=g*dt; //g: gravitation constant
glColor(p.color);
glVertex(p.position);
Simple Particle System: Sprinkler
PL: linked list of particle = empty;
spread=0.1;//how random the initial velocity is
colorSpread=0.1; //how random the colors are
2
For each time step
Generate k particles 1
p=new particle();
1
p->position=(0,0,0); 4
13 3
p->velocity=(0,0,1)+spread*(rnd(), rnd(), rnd()); 2 5 32
p.color=(0,0,1)+colorSpread*(rnd(), rnd(),rnd()); 4 5
5
PL->add(p); 4
For each particle p in PL
6 6th group
p->position+=p->velocity*dt; //dt: time step
p->velocity-=g*dt; //g: gravitation constant
glColor(p.color);
glVertex(p.position);
Simple Particle System: Sprinkler
PL: linked list of particle = empty;
spread=0.1;//how random the initial velocity is
colorSpread=0.1; //how random the colors are
For each time step
Generate k particles
p=new particle();
p->position=(0,0,0);
p->velocity=(0,0,1)+spread*(rnd(), rnd(), rnd());
https://youtu.be/heW3vn1hP2E
p.color=(0,0,1)+colorSpread*(rnd(), rnd(),rnd());
PL->add(p);
For each particle p in PL
p->position+=p->velocity*dt; //dt: time step
p->velocity-=g*dt; //g: gravitation constant
glColor(p.color);
glVertex(p.position);
Demo with Processing
http://processing.org/learning/topics/simpleparticlesystem.html
Outline
► Particle Systems Overview
► Simple Particle System
►Algorithm
►Math (Solving ODE)
Ordinary Differential Equations
Ordinary Differential Equations
► Given a function f(X,t) compute X(t)
► Typically, initial value problems: X - state
►Given values X(t0)=X0
►Find values X(t) for t > t0
Did we just see it?
Ordinary Differential Equations
► Given a function f(X,t) compute X(t)
► Typically, initial value problems:
►Given values X(t0)=X0
►Find values X(t) for t > t0
Emitter (0, 0, 0)
Ordinary Differential Equations
► Given a function f(X,t) compute X(t)
► Typically, initial value problems:
►Given values X(t0)=X0
►Find values X(t) for t > t0
1
Ordinary Differential Equations
► Given a function f(X,t) compute X(t)
► Typically, initial value problems:
►Given values X(t0)=X0
11
►Find values X(t) for t > t0 1
2
Ordinary Differential Equations
► Given a function f(X,t) compute X(t)
► Typically, initial value problems: 1
1
►Given values X(t0)=X0 12
►Find values X(t) for t > t0 2 2
3
Ordinary Differential Equations
► Given a function f(X,t) compute X(t) 1
1
► Typically, initial value problems: 2
1
►Given values X(t0)=X0 2 2
►Find values X(t) for t > t0 3
3 3
4
Ordinary Differential Equations
1 2
► Given a function f(X,t) compute X(t)
1
► Typically, initial value problems: 1
2 3 2
►Given values X(t0)=X0
3 3
4
►Find values X(t) for t > t0
4 4
5
Ordinary Differential Equations
► Given a function f(X,t) compute X(t) 1
► Typically, initial value problems: 4
1
13 3
►Given values X(t0)=X0 2 5 32
4 5
►Find values X(t) for t > t0 5
4
6
Ordinary Differential Equations
► Given a function f(X,t) compute X(t)
► Typically, initial value problems:
►Given values X(t0)=X0
►Find values X(t) for t > t0
► We can use lots of standard tools