-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Particle System Details
Patrick Cozzi edited this page Jun 20, 2013
·
10 revisions
Particles systems are used for smoke, fire, explosion, sparks, clouds, dust, snow, rain, flowing water, etc. Initially, we are are interested in smoke trails.
Initially simulate on the CPU and render with the BillboardCollection.
Abstractions
-
ParticleSystem
- has an
Emitter
- has an
GenerationShape
- Interface for the shape of the emitter. Implementations include:- Sphere with a
radius
- Circle in the
xy
plane with anejectionAngle
allowing cone-like emittance. - To grow/shrink the particle system,
radius
,ejectionAngle
, etc. can vary over time.
- Sphere with a
- has initial particle conditions for:
- Acceleration range. Range is always mean and maximum variance.
- Velocity range.
- Scale.
- Material properties.
- TODO: vary over time.
- has initial conditions for
- Particles per second.
- Total number of particles - so we can allocate a vertex buffer once.
- Start/stop time. Stop after x number of particles, etc.
- has an
- has many
Particle
objects, which each have:-
position
,velocity
, andacceleration
. -
life
- remaining life. -
scale
. Need acollisionRadius
too? -
texture
andcolor
, includingalpha
. Need more general material? - TODO: velocity for varying everything? Per particle? Global?
- TODO: vary over time.
-
- has many
Force
objects - an interface for forces applied to particles. Implementations include:- Directional forces - wind, gravity, and drift (e.g., smoke drifts upward).
- Friction - Don't need this right away.
- TODO: vary over time, e.g., wind speed up or slow down.
- has many
CollisionResponse
objects. Implementations include:-
BouncePlane
, e.g., smoke from a launch vehicle interacting with the ground plane.
-
- has many
ParticleKiller
objects. Implementations include:- Life expires.
- Intensity drops below threshold.
- Positions goes below WGS84. Positions goes outside of bounding volume, etc.
-
TODO: Could more general
ParticleManipulator
that can start changing the particle'salpha
to fade out, etc.
- has an
Reading TODO
- The Design of an API for Particle Systems
- Hardware-based Simulation and Collision Detection for Large Particle Systems
Still need to think about:
- Determine coarse bounding volume so it doesn't need to be updated each frame.
- Update/collide when culled?
- Time can go backwards!
- More
GenerationShape
objects.- Rectangle in the
xy
plane with anejectionAngle
. - Cartographic extent with an
ejectionAngle
.
- Rectangle in the
- Particle rotation and angular velocity.
- Particle mass.
- Particle system hierarchies – particle systems of particle systems.
Performance
- Generate a custom vertex shader to simulate on the GPU, and use custom rendering code for better performance. Try to avoid generate approach that requires VTF and ping-ponging textures.
- Alternatively, explore web workers.
- Number of particles created per frame varies based on the screen-space of the particle system.
Rendering
- Sort back-to-front for alpha blending.
- Draw lines for sparks and/or anti-aliasing.
- Particles casting shadows in general, and shadows onto other particles in particular.
- Particle Systems - A Technique for Modeling a Class of Fuzzy Objects
- Dynamic Particle Systems (Page 120) in Programming Vertex, Geometry, and Pixel Shaders
- The Ocean Spray in Your Face
- Building an Advanced Particle System
- Optimizing the rendering of a particle system
- Fire in the “Vulcan” Demo in GPU Gems
- OpenGL ES Particle System Tutorial
- Humus' Demos
- Flint particle system
- Oak3D Particle Demo
- Generic Particle System in the C4 Engine
- sparks.js
- Creating Particles with Three.js
- Three.js Clouds