Documentation Showcase Screenshots Videos Acknowledgments

Examples


Simple explosion

In this example we will go through step by step the process of creating the basic explosion effect that is included in the Mercury Particle Engine preset effect library. First and foremost we must establish our requirements. There must be flames that radiate from a single point. The explosion must produce smoke which persists for a short while after the explision has finished. The effect must convey a sense of immediacy and violence which are the key characteristics of a real explosion.

Starting with the requirement for smoke, we will add a basic emitter to the particle effect:
ExplosionExample01.PNG
ExplosionExample02.PNG

The smoke emitter will need to be configured like this:
ExplosionExample03.PNG

To specify a texture for the particles, right click on the emitter, then click "select texture". A dialog window will open which shows you the available textures, and also lets you import your own images. Highlight a texture in the list, and click "ok".
ExplosionExample04.PNG
ExplosionExample05.PNG

We will now add four modifiers to the emitter, an OpacityModifier, a ScaleModifier, a DampingModifier and a RotationModifier:
ExplosionExample06.PNG

The OpacityModifier is used to adjust the opacity of particles over their lifetime. In this case, we want the smoke to start out semi-transparent, and gradually become more transparent over time. The OpacityModifier exposes two properties, InitialOpacity and UltimateOpacity. InitialOpacity is the transparency of the particles when they are first released. UltimateOpacity is the transparency of particles when they reach the end of the their lifetime. At all points inbetween, the transparency of the particles is calculated by a linear interpolation between these two values. For our smoke effect, we require an InitialOpacity of 0.2, and an UltimateOpacity of 0.0.

The ScaleModifier works in a similar way to the OpacityModifier, but instead of adjusting the opacity of particles, it adjusts the scale. Like the OpacityModifier, it exposes two properties, InitialScale and UltimateScale. For our smoke effect, we will require an InitialScale of 48, and an UltimateScale of 255. This will cause the smoke particles to grow significantly over their lifetime.

The DampingModifier is used to apply a damping force to particles, which has the effect of slowing them down as they travel through space. The damping force is calculated as a percentage of the velocity of the particle, inverted and applied over time. For example, a particle moving at 100 units per second, with a damping coefficient of 0.8 applied, will slow by 80 units per second. However it is important to understand the exponential nature of this calculation. For this effect, we will apply a damping coefficient value of 0.8.

Finally, the RotationModifier quite simply rotates particles at a defined rate, measured in radians per second. For example, setting the rotation rate to 2π will cause particles to make one full revolution per second clockwise, while -2π will cause particles to make one full revolution per second, anti-clockwise. Our smoke particles will need to rotate one radian clockwise over each second.

Last edited Aug 25, 2009 at 3:01 PM by JimJams, version 3