EasyGame Lesson11 – Explosion Particle Effect
Particles are some kind of visual effect, such as explosion, gun shot spark, or fountain, rain and so on. Usually, they are transparent meshes or planes. From my experience, you could not play too many particles effect in the view at the same time. This will cause some serious frame rate problem, and the situation will become worse when the particle material is very complicated. Because the transparent objects render overlap the solid objects, this will cause some large area covered and re-paint on the screen frame buffer. Of course, you may want to adopt a separate and small frame buffer to hold the transparent objects. But you need to provide a small depth buffer at the same time.
Another thing need to take care about particle is DO NOT load particle at the running time. You should pre-load them during the level loading.
When you want to design your own particle system, please separate the time varying vertex element from time constant vertex element. That means you read the data you want and update it, no more or less. With CPU data cache feature, continues data will be processed much faster than no-continues data. Although this way will break the Object-Oriented policy, but some evidence already proved this could improve the performance.
This sample shows us a simple explosion particle effect. This particle will update as time goes by, and disappear at last.
The full source code could be found from here.