by Michael Ludwig
Water fountain with gravity and bouncing.
Fire and smoke simulation with textured sprites.
Snow simulation with Perlin noise field to simulate wind gusts (also with textured snow flakes).
Magic explosion that changes from yellow to red, has a trail, and explodes like a firework.
The explosion particles are then subject to gravity and bounce off of the flow, creating a fireball like effect.
This assignments code can be downloaded here: [link]. It contains all dependencies required to run it, as well as the Java source code of the actual particle system. The script 'run.sh' should work for any Unix-like system with Java 6 in the path. Windows native libaries are provided, too, but the script will have to be modified.
If for any reason code can't be run, I've uploaded a video of the simulations: [link]
It was easy to get side-tracked fiddling with the different parameters to get simulations looking just right. Since I did not create a particle editor, it meant I had to recompile everything so that increased the delay between tests even more.
I learned that you had to z-sort particles that do not emit light in order to get proper blending with OpenGL. You do not need to sort particles that emit light since they do additive blending without modifying the destination color. My implementation does not let a single system do both types of particles, but z-sorting is done within a system. This meant that my fire and smoke simulation that uses both only looks correct from certain angles. If you were to look beneath the fire, the smoke would be rendered on top of the fire incorrectly.
After working with my implementation for a while, I think I did not create the best interface for specifying effects on the particles. It was very tedious in my current API to have multiple emitters in the same system, that also could then have different effects applied to their emitted particles. I got around this by tacking on customizable attributes in a map.