Not Quite Fire

When I was a teen, I liked to build fires. Sitting in front of a fire, I began to wonder if it was possible to simulate a fire on the computer. After watching the fire for quite some time and having absolutely no idea how such a thing could be done, I began to come up with some insights, and a plan. Watch the behavior, make assumptions about the rules that lead to that behavior, then write the code.

My assumptions where that above a certain temperature, gas produces light. Heat is dissipated to the environment (temperature averaged over any given area). And that heat rises. These were enough to get started. All I would have to do is average neighboring pixel values to get each new value. Averaging more pixels from below (than above) would have an effect similar to rising hot air. I was thrilled with the results. But, after some time watching my new simulation, I noticed that something was off.

It seemed that the fire preferred not to divide into individual flames. What was wrong? After some thought, I realized that the fire was not the only agent. The cooler air also had to be calculated. Colder air is denser and falls. This pushes it's way into the fire crating division, flames. After adding that change, the fire's appearance was quite convincing. That was a long time ago.

Sorry to disappoint, bit here I am using a somewhat different method for my fire simulator. And, yes, it is a but unimpressive right now. The general function being applied for now is, for every pixel we get the average of a set of pixels above and the average of a similar set of pixels below. If the pixel value is closer to one, increase that disposition by a small amount.

We will see what I do with it in my free time. I have some ideas...