Just a quick post today regarding something I’ve been tinkering with. My experience with Zita Asteria included doing a few of its particle systems and they can be a lot of fun to play with. I might do a more general tutorial on creating particle systems some day when they come more naturally to me. For now I suggest a more informal approach, by simply visualizing the system before coding.

As usual, a list of ingredients :

–          Visual Studio C# Express 2010

–          XNA 4.0

–          DPSF ( Dynamic Particle System Framework )

The DPSF API is pretty well black boxed but I want to still give a run down of the basic lines of code you’ll need to get particle systems running.

The following should be enough to get started :

1)   An attribute, the particle system manager of type ParticleSystemManager

2)  Adding the particle systems needed using particleSystemManager.AddParticleSystem(particleSystem);

3)  An update call – particleSystemManager.UpdateAllParticleSystems(elapsedTime)

4)  Config calls

a.  particleSystemManager.SetCameraPositionForAllParticleSystems(cameraLocation)

b.  particleSystemManager.SetWorldViewProjectionMatricesForAllParticleSystems(msWorldMatrix, msViewMatrix, msProjectionMatrix);

5)  A draw call – particleSystemManager.DrawAllParticleSystems()

 

Any other code needed will be specific to the particle system you might be using.

The particle system I put together to demo this is extremely simplistic but it does demo the basics of one of DPSF’s classes. It also incorporates basic rotation using some of the DPSF utility methods although I didn’t use the traditional DPSF delegates for simplicity’s sake.

Each particle essentially has two aspects to its behaviour :

1)      Rotational velocity relative to the emitter’s location ( not the center of the particle )

2)      Vertical linear velocity ( essentially increasing  y-component )

That’s this system in a nutshell. Here is a screenshot of it running :

 

A thanks goes to the DPSF project team for the textures supplied in the source!

I hope this helps someone. Well implemented particle systems add quality to any visuals.

If you want the project source : Whirlwind Particle System Demo

Ciao All

« »