Overview

This entirely self-contained particle engine was written in C++ under Visual Studio .NET. It was used in several of my larger programming projects, including Little Johnny Has Cirrhosis. It includes the following features/effects:

  • Encapsulated inside a C++ class, so the user can include the engine in any OpenGL project by making calls to only a few simple interface functions
  • User-specifiable emitter-position
  • Point or Line sources
  • User-specifiable angle of emission
  • Variable particle emission velocities
  • Variable particle lifetimes
  • Variable particle sizes
  • Textured/colored/blended particles
  • Universal (i.e. specified by a direction) Gravity
  • Local (i.e. specified by a point) gravity
  • Time-based or Frame-based movement

Images

Here is a shot of the driver I wrote for testing & debugging; it's a simple windows dialog box that controls the particle engine. The actual rendering is performed in a separate popup GLUT window:

img

Here is an example of some particles shooting out towards the left, and being sucked in by a gravity-point near the center of the cube; The cube is included in the background to show the particles’ transparency.

img

Here, the particles are being emitted straight up, and being sucked into a gravity-point just above and to the right of the emitter

img

This is what happens if you give a gravity-point a negative strength: it repels particles

img

All of the above examples use some randomization for the particle lifetimes, therefore particles are emitted in a constant stream. Below, every particle has the same lifetime, so they are emitted in bursts that look like rings coming out from one point

img

Here is an example where the emitter bursts new particles out before reclaiming all of the particles from a previous burst

img

This is what a line-source looks like, with solid (non-blended) particles

img

Finally, some general gravity in the y-direction…looks like a water fountain!

img

Video

Here's a short clip of the engine in action:

Contact | Terms & Privacy
©2004-2025 Justin Klein
whos online
Feedburner
HTML5 Valid
05-17-2025 11:41:50UTC 0.27s 48q 31.47MB