Particle Systems

The term particle system refers to a computer graphics technique that uses a large number of very small sprites or other graphic objects to simulate certain kinds of "fuzzy" phenomena, which are otherwise very hard to reproduce with conventional rendering techniques - usually highly chaotic systems, natural phenomena, and/or processes caused by chemical reactions.

particle system simulating smoke

 

Examples of such phenomena which are commonly replicated using particle systems include fireexplosionssmoke, moving water (such as a waterfall), sparksfalling leavescloudsfogsnowdustmeteor tails, stars and galaxies, or abstract visual effects like glowing trails, magic spells, etc. - these use particles that fade out quickly and are then re-emitted from the effect's source.

particles

 

Components of a particle system

Emmiter

An emmiter controls the position and movement of a particle system. The emmiter acts as the source of particles, and determines where and what rate the particles are generated. The emmiter will have a number of properties;

  1. spawing rate
  2. spawning "surface" (point, plane, mesh etc)
  3. particles' initial velocity (may be normal to surface)
  4. particles' lifetime
  5. initial particle colour/texture

Typically the emmiter will randomly vary these properties around an average value.

During each update phase the emmitter will generate a number of particles based on the emmiter's properties. the number of particles generated will depend on time between updates and emmitter rate. The initial position of each particle is based on the emmiters psoition (& spawning surface).

Particles

The realisim of particle systems depend on the overall visual effect of many particles being rendered in a small area. Each particle is a visible element, usually one of three types;

Billboarding

billboarding doom

Billboarding is a technique to cheaply simulate an object in a 3D environment, by only rendering a 2D image (sprite or texture) within the scene. The sprite is rendered in such a way that it always faced the camera.

Billboarding is frequently used in particle effects because it is cheap and the user is not looking at individual particles, but at the totality of the effect of 100's of overlapping sprites.

In XNA billboarding is done by generating a quad of vertices centered on teh origin, lying on the xy-plane and using the CreateBillboard method to generate the particle's world matrix

Particle Sprites

selection of particle sprites

The texture used for the particle depends on the effect. Almost always the background of the partice is transparent and the visible part has a roundish shape.

Particle behaviour

After spawning the particles behaviour will depend on the effect. The particle can continue on it's initial velocity, may be influenced by forces (e.g. gravity or wind, air resistance), engage in flocking beahiour or follow some procedurally generated path.

Additionally, the particle may change size over time (get bigger for smoke effects). Non-circular particles will often slowly rotate and random angular velocities in order to help aceive a natural look.

Finally, the texture used for a particle may gradually change overtime (e.g. flame turns to smoke)

Particle lifetimes

Particles usually don't exist forever, they have a set lifetime after which they are deleted. In order to avoid particles suddenly poping out of exisitance, they are programmed to become increasingly transparent as they approach the end of their lifespan. Particles may also go out of existance if the hit the ground or other objects.

Particle drawing

Particles are usually drawn;

  1. after all other objects
  2. with additive blending
  3. depthbuffer writing turned off