Fire

Before jumping right into the fire effect programming, we should take a short brake and think about the bitmap we will be using.

Our fire should include the whole color palette from a dark transparent red at the edges to orange, yellow and bright yellow or even white tones at the 'hot' middle.

Achieving this with only one bitmap seems like a hard task, since we are building up our flames by combining many particles. Using only a few bigger images would make the fire too rigid and would take away from the blazing effect. We want a fire that is smoothly 'breathing and living' and not only some predefined 'dia-show' animation frames.

But wait!
We have learned to use the 'my_bright' option in the last tutorial. After all, maybe it's not too hard to create a fire with all those color nuances we need.

We just need a bitmap, that consists of red and dark orange colors, these nicely add up to orange, yellow and even white if we produce enough overlapping particles.
In order to prevent hard particle edges and too hard color transitions, we will use an alpha channel for our bitmap. The alpha channel defines that the particle has smooth, transparent edges that blend nicely and 'almost invisibly' over other particles.

Here are the main image and the alpha channel we will be using:

  

Note that the image has a flamelike form. The reason for this is quite simple: Since we will include some randomness into the behaviour of the particles, it is possible that some particles near the edges will be visible without other overlapping particles 'hiding' their real shape.
If these particles would have a 'non-fitting' (circular or blocky) shape, they would be easily spotted and would probably ruin the overall effect. We don't want the user to be thinking about the effect mechanics, we want him to 'see and sense a fire', nothing more or less.

next page >>