Thursday 28 June 2012

3D PointSprite Particles



The initial notion for this came from this site here where the author gives a basic example of a particle system. The particle shader used in this example is in fact from the very example posted there. I have tried to visit this link at the time of writing this post and it looks like the site is under development.

As you can see in the example this particle system can manage up to 10K of particles without dropping the FPS below 60 which I think is quite good as my previous attempts, first using a textured quad (you can see this if you take a look at my RCSnow class in the Randomchaos3DEngine source) gave poor performance at around 1.5K particles and another system I wrote using a single draw with a vertex array was pretty efficient at low particle counts like 2 or 3K but 10K gave a big drop. You also have to keep in mind that the screen shots were taken on a crappy old laptop that does not have the resources to do any real 3D, I will have to run it on my desk top and see what FPS I get then...

In this example there is also a FPS class so you can calculate you FPS (Frames Per Second). Also a method of displaying text using the native XNA Refresh methods rather than Nuclex Fonts. I am also reusing the SkyBox and Camera class show in the last example.

I guess the next step will be to do ALL the particles physics on the GPU, one step at a time eh...

Controls
Mouse to rotate camera.
Arrow keys to translate camera.
Escape to exit.
F1 - F10 alter number of particles
F11 & F12 switch between particle modes.
R,G,B & C to cycle particle colours from Red,Blue,Green and Random

Any comments on this example, please post them here, especially if you are getting great FPS, be nice to know how many particles it can render and keep the FPS over 60

GenericExampleParticleSystem.zip

No comments:

Post a Comment