Making Fire Sand

Let's try another favorite, fire. A material that turns other burning materials to fire. And dies after some time.

Create new sand

Create new sand by copying another one.

new fire name and visuals

Give your sand a new name, fire, fire-like color and toggle the variate, blur, Extend Radius flags on under the visuals.

Physics settings

Fire is going to be a gas like material, liquid that moves upwards - to the opposite gravity direction. Give it the following physics settings.

fire physics settings

Fire moves up, behaves like liquid, but is affected by forces normally.

Rules

First behavior we want to add to fire is that it should die over time. Edit the graph to be like this.

fire die over time

This rule now says the following: With probability P < 0.1 (each frame), turn fire to empty, else remain as is.

You will now see fire die after some variable time.

fire die moving

Now all those fire sand move very similarly to each other. To simulate sparks, it would be nice if some fire sand moved slower than others. Let's do that.

Let's change the graph to following.

fire with sparks graph

The difference here now is that we wish to turn some fire to a new fire, which means that their velocity is reset to 0.0. Else stay the same as before. This way some fire will move slower than others, creating the sparks like behavior.

We're using Math: Random with seed to get a different probability from the Math: Random, and we consider the else case where sand did not turn to Empty.

Basically we're saying:

With P1 < 0.1, turn fire to empty. Else, with P2 < 0.1, turn fire into fire, else remain as is.

Fire now looks like actual fire with sparks.

๐Ÿ“˜  Note

Using Random with seed ensures you can generate multiple random numbers with different P within the same graph. If you only use Random, all your P within the same frame will output the same value. That is, because they are seeded with position and time, and within the same frame for a single function, these are the same. For seed use offsets of 0.0-1.0.

fire with sparks.

Reaction

Last thing missing is fire burning other sand. Add the following characteristic to fire: BURNS.

burns characteristic

And to any sand material you wish to burn, add the following.

burns other sand graph

Now fire should burn your desired other sand.

burns other sand

Was this page helpful?