Mega Particles Slides
Mega Particles Slides
Lutz Latta
Massive Development GmbH
Overview
1962
Second video game
ever!
Uses pixel clouds as
explosions
Random motion
Spacewar!
Asteroids
1978
Uses short moving
vectors for
explosions
Probably first
physical particle
simulation in
CG/games
1983
Movie Visual FX:
Planetary fire wall
First CG paper about
particle systems by
William T. Reeves
Today concept still
unaltered!
Explosions
Smoke
Fog
Weapon FX
Impact FX
Euler Integration
10
t
a
v
v
p
p
Computationally simple
Needs storage of particle position and
velocity
time step
acceleration
velocity
prev. veloc.
position
prev. pos.
Verlet Integration
11
Stateless simulation
Only simple effects
Simulation in vertex shader
Possible on first generation programmable GPUs
!
W
NE Simulation with textures and pixel shaders
Only on recent generation GPUs
12
13
No storage of varying
particle data
Evaluation of closed form
function describing
movement/attribute changes
Computed data depends only
on initial values and static
environment description
Example of Stateless PS
14
f t
k1
k2
k0
k3
First segment:
k 1k 0
k 1k 0
f 0 t =
tk 0
t 0 =mtb
t 1t 0
t 1t 0
15
Algorithm of Stateless PS
At particle birth
Upload time of birth and initial
values to dynamic vertex buffer
In extreme cases only a random seed
needs to be uploaded as initial value
At rendering time
Set global function
parameters as vertex
shader constants
Now...
...let's talk about some hot new stuff!
17
State-Preserving Simulation
18
(x/y/z)
double
buffer
(x/y/z)
Velocity
texture
(x/y/z)
double
buffer
(x/y/z)
Static info
(tob/pt)
per particle:
time of birth (tob),
particle type (pt) ...
19
20
21
Birth of a Particle/Allocation
22
Death of Particles
23
Velocity Operations
24
Velocity Ops:
25
r distance
Fall off with 21 or at hard
r
small epsilon
boundary
Individual particles might scale effect
based on mass, air resistance etc.
V. Ops: Global
wind
gravity
26
magnet
sum of forces
Velocity Ops:
v P
Dampening
v=cv
Dampening:
Scale down velocity vector
Simulates slow down in viscous materials
Un-dampening:
Scale up velocity vector
Simulates self-moving objects, e.g. bee swarm
27
Velocity Ops:
Collision
Algorithm:
1. Detect collision with expected new position
2. Determine surface normal at approximate
penetration point
3. React on collision, i.e. alter velocity
28
Collision Reaction
v t =v v n
n
vt
vn
29
v
vt
v
vn
31
Position Update
P
Euler integration:
Verlet integration:
Apply acceleration caused by forces
Apply other simple effects like dampening etc.
Collision is best handled with position
constraints, i.e. move particle outside a sphere
Collision reaction is then stored implicitly in
constraint-based position shift
32
33
Try first:
Check whether commutative blending
(add, multiply) can be used instead!
Otherwise:
The GPU can sort nowadays...
Put viewer-distance and index into a texture
Sort this texture (at least partially)
Render with indirection over sorted indices
34
Sorting Networks
35
8 data elements
3
2
1
36
37
copy
vertex stream
38
Vertex Textures
39
read index
read data
vertex
shader
Rendering
40
41
42
43
Demo
...
44
Conclusion
45
Questions