JavaScript EditorFree JavaScript Editor     Ajax Editor 

Main Page
  Previous Section Next Section

Anatomy of a Particle System

A particle system is essentially a mathematical formalism used to describe phenomena that are

  • Dynamic and time dependent

  • Highly parallel with small individual components

  • Complex

Examples of such behavior include smoke from a chimney, fire, birds flying in a flock, snowflakes, and hundreds of other phenomena. Particle systems are context insensitive, meaning they can be used to model very different situations. The particle system is a tool, but does not imply a specific use-case in itself. By changing some of its inner components, it can be suited to any problem, as long as it follows the global philosophy outlined earlier.

Particle systems were introduced in the early 1980s by Pixar (then part of the Lucasfilm special effects group) for the movie Star Trek II: The Wrath of Kahn. Specifically, particle systems were used to represent a chain-reaction explosion on the surface of a planet, so the planet changed from a dead, barren look to a full living ecosystem.

A particle system fundamentally consists of an array of particles, each one changing dynamically according to some established routines. You can model individual raindrops reacting to gravity and wind, birds executing a simple AI routine, and so on. All particles have the same parameters controlling their look and behavior. But as they evolve in their ecosystem, each follows a slightly different evolution, and the desired complexity emerges naturally.

Local Versus Global Particle Systems

Particle systems can broadly be divided into two large groups, which I will refer to as local and global. A local system consists of a group of particles that behave as if each one was alone. Thus, interactions between particles are not taken into consideration, and all calculations are local to the current particle. On the other end of the spectrum, a global particle system involves particles that interact and react to each other. In these particle systems, the behavior of each individual particle depends in part on its own characteristics, but also on the interactions with the rest of the group.

Many times a local system is nothing but a simplification of a global system. For example, consider a group of fallen leaves from a tree, blown by the wind. If you want to model them accurately, you need to consider changes in the trajectory if two or more leaves collide, making the behavior of the single leaf dependent on the rest. Clearly, this would yield a global particle system. But many games prefer to ignore leaf collision and, by simplifying the simulation, implement it as a local particle system.

As you will soon discover, both groups have different advantages and problems, and require specific programming techniques. Obviously, global particle systems produce much more complex and interesting behavior. But richness does not come for free. Calculating the influence of the other particles will usually increase our computational costs significantly. So, global particle systems must be handled with care.

      Previous Section Next Section

    JavaScript EditorAjax Editor     JavaScript Editor