ThinGaMagic2000

Simple Particle System Editor

Downloads

thingamagic_111004.zip

v0.5

ThinGaMagic2000 v0.5

32bit windows binaries. This is most likely the package you want.

thingamagic_src_111004.zip

sources

ThinGaMagic2000 v0.5 sources

C/C++ sources. Only compiles under windows for now. Only grab this if you need the source, want to port to another platform, or feel adventurous or curious. You don't need this to play with ThinGaMagic2000.

Background

Back around the year 2000 I wrote a simple particle system for X-Forge. It was called "ThinGamaJig", and it was designed to be very lightweight and thus suitable for mobile devices at the time, while versatile enough to generate all sorts of effects.

This is a reimaging of the same editor, written from scratch. It has many of the same features, missing some while gaining others.

Physics

The physics behind the particles are relatively simple. Every iteration, every particle goes through the following relatively simple formulas;

Position

  • p = position
  • p0 = previous position
  • v0 = previous velocity
  • t = time elapsed
  • a = acceleration

Velocity

  • v = velocity
  • v0 = previous velocity
  • a = acceleration
  • t = time elapsed

Acceleration

  • a = acceleration
  • Fg = gravitational force
  • a0 = previous acceleration
  • Fd = damping force (drag)

Noise

Just a little bit more of scary math before we get to the good stuff.

Many aspects of ThinGaMagic2000 particles are affected by noise controllers. Each noise controller has four parameters:

  • Base value
  • Noise type
  • Noise amplitude
  • Noise period

So for each parameter that needs noise, we calculate noisefunction(time / period) * amplitude + base. The following picture may help in understanding amplitude and period further:

ThinGaMagic2000 has the following noise types:

  • Disabled The disabled mode only uses the base value.
  • Random (sharp) Sharp random changes the random value once per period, and keeps the value for the period.
  • Random (interpolated) The interpolated random smoothly interpolates between two random values once per period.
  • Sine wave Sine wave follows the sine wave.
  • Cosine wave Cosine wave follows the cosine wave.
  • Triangle wave Triangle wave follows the sine wave.
  • Cotriangle wave Cotriangle wave is basically the same for triangle as cosine is for sine.

If the period is zero, a random value is picked on every iteration (unless the noise mode is disabled)

User Interface

The ThinGaMagic2000 user interface consists of the following parts:

  • a - currently visible particle count
  • b - editor windows (minimized here)
  • c - frame rate counter
  • d - rendering area

You should always try to keep the visible particle count as low as possible for the effect you're creating for performance reasons. Especially if the particle system is going to be integrated into some complex 3d world, it's good to keep your particle systems relatively lightweight not to cause any performance issues.

You can rotate the camera by dragging on the rendering area. Control-dragging moves the particle system emitter.

To actually perform modifications to the particle system, open some of the editor windows (b). Note that you can resize the whole editor window if you want to have more work room.

Emitter parameters

You can edit two aspects of the emitter - it's current position and its size.

The current position is not saved with the particle system. You can also adjust the x/y position by control-dragging the edit area.

By changing the emitter size, you can make point (0,0,0), line, square or cubic emitters. Whenever a new particle is spawned, a random position inside this volume is selected.

Geometry parameters

Particle geometry consists of size and rotation parameters. The start and end sizes can be used to make the particles grow or shrink as they age.

R is the initial rotation of the particles, in radians. Ri is the increment per iteration.

Launch parameters

The particle launch parameters are simply the initial velocities of the particles. By picking different kinds of noise functions you can create flames, explosions, streams of liquid, etc.

Life parameters

All sorts of particle lifespan parameters can be found in this panel.

The topmost "reset particle system" is actually a button, and can be used to reset the particle system. Handy when you're tweaking the lifespan parameters.

Pre-tick is the number of iterations that the system should be ticked at reset time. This is to avoid the "deus ex" style glitch of fog rising from sewers only when you're looking.

Life is how long a particle should live, in milliseconds. 2000 means two seconds. Some noise (50% or so) is recommended to avoid glitches when reducing the particle count - experiment to find what looks good.

Particle count is the maximum number of particles that are permitted to exist at the same time. This affects the memory resources allocated for the particle system, so it's best to get this as small as possible.

Alloc strategy controls what happens when a new particle is being spawned and there's no room. The default method is to simply pick a random particle slot. "Prefer old" does nothing if the random slot is already occupied. "Prefer new" overwrites the old particle with the new. "First fit" scans through the whole particle storage to find empty slots, which can be time-consuming. If all slots are used, nothing is done.

Any of the above may result in glitches, which can be solved by either rising the particle count or adding more noise to the particle lifespan.

Emit Hz says how many particles should be emitted per second. Emit # says how many particles should be spawned every time we're spawning particles. By setting the Hz to a low figure and # to something high, you can create a steam-powered train puffs, for instance.

Physics parameters

The physics parameters are applied to the particles on every iteration. The "g" is gravity, but can be used for other things, like wind. Damping factors can be used to slow things down.

System controls

System controls include camera parameters, which are not stored with the particle system. You can also rotate the camera by dragging on the rendering area.

You can also save and load the particle system here. The saved .pr4 files are simple JSON dumps of the particle system parameters.

Texture parameters

This panel has all sorts of controls related to how a single particle looks.

The alpha start and end control the transparency of the particle during its lifetime. 1.0 means solid, 0.0 means invisible.

Start and end colors can be used to play around with the vertex colors; they work the same way as the alpha.

Three different blend modes are supported: alpha blend is most solid, but requires alpha channel in the texture (unless you like square particles). They're most useful for particles that are supposed to be solid (like shrapnel or coins).

Additive blend makes things brighter, meaning that you can use textures with a black background. They're most useful for explosions, fire and such.

Multiplicative blend makes things darker, so the texture can have a white background. They're most useful for smoke and forces of darkness and such.

Depth writes control how the particles interact with the depth buffer. If depth writes are enabled, the particles can occlude other things, but this may lead to rendering glitches. The particles always read the depth buffer (so they can be occluded).

Sorting of the particles is not implemented at this time, and it's unsure if I ever get to do that; it's rather performance intensive, but might be fun to see just how much so.

You can also load textures here. The textures are supposed to be square. For multiple-frame animated textures, make tall textures; the number of frames is calculated by dividing the height with the width.

For convenience, you can edit the texture in your image editor of choise and then click on "reload texture" to ask ThinGaMagic2000 to reload the texture.

Conclusion

This is not the only, or the best way to make particle systems, but it's capable enough for lots of experimentation. More noise controllers could be added, for instance - even noise controller parameters might gain from some noise controllers. Maybe that's why many particle system editors are graph-based.

Anyway, have fun with it; many interesting particle behaviors can be found simply by experimenting with the parameters. If you create some great effects, I'd love to see them =)

(As always, comments are appreciated).