Hi Lupo!
I have just created 3 months ago a Particle System for my game engine.
With it you can also create fireworks effects.
Let me help you giving you some tips:
- Use a point-sprite particle system. This will be enough for fireworks and its easier than using a billboard particle system. You must use the point sprite OpenGL extension. Don’t panic because of the word! It’s easy
- I don’t know how real you want it. For cool effect you should add some additional properties to your particles in addition to Position, Velocity, Acceleration, Particle_Life_Time and Color.
I want really cool effects you must add Color per particle coloring. In this way you can control the color of each individual particle.
There an intresting concept called “Milestones”, that is when a particle’s Life reached the Milestone value something else happens. In my particle system I have Color milestone and Alpha Milestone. In this way, if Color Milestone for the particle system is 80%, then when a particle’s life reaches 80% the color will fade with ColorFadeVelocity(R,G,B). That is, you will need to add ColorFadeVeloicity as a propery for each particle system.
As with the other mielstone, If the Alpha Milestone is 50% then the particle starts becoming transparent at a rate of AlphaFadeSpeed(seed).
This enables you to add special effects such as particles that change colors, or that fade to transparent. The milestones feautre provides an intresting effect, since the colors of the particles persist and only change once reached certain point of the particle’s life. The changes are gradual, so the effects can be astonishing.
3)If you are concerned with performance then you should use Vertex Arrays (OpenGl feature). Others may argue that you should use Vertex Buffer Arrays (and they are right! ); However, this vertex arrays is very easy to implement and should do fine (I am still using vertex arrays).
Beware that if you are just rendering fireworks then you will probably have no problems at all!
My particle system renders with a full skybox, mountainbox, animated clouds, and some complex vertex objects and it only consumes few FPS.
So you will probably have no problem.
Another important feature is Velocity Varianze. That is you must add and stochastic factor -a random factor- to your particle system in other to make particles follow different directions.
In each frame, each particle’s velocity is updated with the Velocity Varianze factor. If the factor is 0 then all particles will be superposed and follow the same direction. If the factor is very large, particles will behave very randomly going everywhere.
Last thing to consider is Emmission Mode.
Emmision modes can be point, line, plane, volume, etc. The easiest to do is point emmision, which will be useful for you fireworks. However, doing line, plane, or volume emmiision is easy. Just change the initial position values by multiplying with random numbers in some predermined intervals. In other words, doing all the emission modes mentioned above is really easy, for example for volume emission multiple the original position values (the position where the particles revive after dying) by (Random(-3,3) ,Random(-3,3),Random(-3,3)) to get an emmission cube of sides equal 6.
Multiply by (Random(-3,3) ,0,0)
to get 6 length emmission line.
Just to mention, if you don’t know, as I said before particles have a property called Life. You must define in the particle system what is the maximum time they can live. Once this time is reached particles must ‘die’ and regenerate. Particles are regenerated with the emission modes mentioned above at a particular point, region or volume.
For the particles to regenerate, it means that the memory of the pointer particle is reused and taken to the list of active or alive particles.
This may all sound difficult, but it isn’t!
Don’t start alone. Learn from examples.
These are the examples that helped me build my particle system:
Simple Particle System Example with Fire
Most inspiring example from Advanced OpenGL Book
Download the whole source code examples. There is a source example on Particle Systems. It’s really good. It even includes a script loader. The only drawback is that it’s in 2D, however, it should be easy to make it 3D with some changes.
These are articles that helped me learn more about the subject and add new features:
Hope all this is useful.
I hope you achieve great success in your project!
180hrs is plenty plenty of time in my consideration! You’ll be fine, but work hard so you finish earlier.
Cheers!
Rod