Simulating fire with particles
To create an effect that roughly simulates fire, we only need to make a few changes to our basic particle system. Since fire is a substance that is only slightly affected by gravity, we don't worry about a downward gravitational acceleration. In fact, we'll actually use a slight upwards acceleration to make the particles spread out near the top of the flame. We'll also spread out the initial positions of the particles so that the base of the flame is not just a single point. Of course, we'll need to use a particle texture that has the red and orange colors associated with flame.
The following image shows an example of the running particle system:
The texture that was used for the particles looks like a light "smudge" of the flame's colors. It is not shown here because it would not be very visible in print.
Getting ready
Start with the basic particle system presented in the recipe Creating a particle system using transform feedback.
Set the uniform variable Accel...