[Bf-committers] fire simulation

Lukas Tönne lukas.toenne at googlemail.com
Tue Jan 5 22:01:11 CET 2010

Hello blenderheads!

I have lately spent some thought and did some research concerning fire
simulation, because i think it is a feature desired by many blender users
(including me) and one that apparently hasn't been seriously developed for
Blender yet. I know the smoke simulator (which is great btw) can be modified
to simulate hot gas clouds, but to achieve a greater amount of detail, as
can be seen in fires (as opposed to explosion-like gas clouds), one needs a
different kind of simulation. By now i have a pretty clear idea of what i
could achieve in reasonable time and effort (and what not - see below). Fire
is an extremely complex matter, as it involves a lot of very different
processes, which all depend on and influence each other more or less.
Luckily most of these processes can be modelled separately and linked to
each other indirectly by some well designed interfaces (more on that later).

Processes involved in and linked to fire (not claiming completeness):

- Flames
    Most kinds of burning fuel produce gases that rise up in the air in
small clouds (commonly called "flames") until their fuel is used up and they
vanish. This is the process i want to concentrate on, since it covers a wide
range of phenomena and produces impressive visual effects. The method i want
to implement is pretty much what is described in this paper:


(hint: take a look at the pictures on the last page ;) )
I will describe details below.

- Flame fronts / ignition
    An important aspect of fire is the way flames spread on a burning object
and ignite it. The physical effect is caused by the temperature rising above
a threshold ("ignition point") close to existing flames. The amount of
flames produced in a certain area depends on the rate of fuel release, while
the duration of flame production depends on the availability of fuel. These
surface and/or volume properties could be modelled by some sort of texture
mapping or meshes, but they are not a direct part of the flame simulation
system. Instead, i'd rather opt for using an intermediate particle system to
model the spreading of flames in space. This would offer a great deal of
flexibility and different ways of simulating ignition effects, while the
separation makes it possible to postpone this work until the flame
simulation is in place.

Paper describing a model for flame front development and flame simulation:

Similar, but slightly more sophisticated model:

- Burning
    Stuff that burns usually changes appearance and surface properties: Wood
turns to ash, a candle's wax melts away and some fuels are completely used
up when burning. These effects are so diverse and complex, that it's not
feasible to produce a "one-for-all" simulation system that covers all these
effects. It should rather be up to the artist to model the damage inflicted
on burning objects and the way they are rendered. Again, it could be
possible to provide assistance in the form of "melt" or "burn" modifiers,
which eat away material from solid objects, but this is not what i am
focusing on now.

- Smoke
    Many fires not only produce hot gas, but also release a great amount of
solid particles into the air, which are visible as smoke. Since we already
have a very nice smoke simulator, it should be easy to emit smoke from
flames by creating particles somewhere in the flame, which in turn are used
as input for the smoke simulation. IIRC this is somewhat similar to the way
foam can be simulated alongside fluids by particles.

- Explosion
    Sudden release of burning gases causes fireballs and all the other
effects known from TV and movies (hopefully not real life ;) ). These
effects are best modelled by some sort of "fluid" simulation (compare to the
fluid and smoke simulators) and also won't be part of the feature i'm
working on. However, it should be possible to modify the fluid simulator
for this purpose and link the resulting dynamic gas clouds to burning
surfaces in a convincing way.

Paper on CFD of explosions:

So what i'd like to work on for now is really just the simulation and
rendering of flames. This task can again be split up as follows:

1) Flame filament data structure
    The "core" of each flame in the simulation is a structure called
"filament", which is basically a set of control points with a spline curve
fitted on them. After simulating the control points as a kind of physical
particles (see the first paper for details), the spline is refitted and the
points are evenly spaced on the spline to avoid artifacts.
    This data can be stored in a cache structure (similar to point caches),
so the simulation can handle a large amount of flames without having to keep
all data in memory.
    On a side note, this filament structure could possibly be used for other
simulation purposes too, which is why i want to keep it clearly separate
from the actual flame simulation (see for example this paper describing a
highly detailed smoke simulation using a similar structure:

2) Physical simulation
    This is essentially a specialized particle simulation, which animates
the filament control points. Each point is moved according to
    - Force fields: this allows general artist influence on the flame
    - Buoyancy: this is what causes flames to rise up into the air. Depends
on ambient temperature and gravity
    - Collision: just like fluids, objects can be made obstacles for flames
    - Turbulence: random brownian motion is applied to simulate diffusion

3) Flame rendering
    Rendering flames is probably done best by using a volumetric material.
To feed some density information (and possibly color, etc.), i intend to use
a point cache, which gets filled according to the flame filaments and a
flame shape function determining thickness at each spline position (again,
see the paper for details). This is probably more efficient than directly
evaluating the filament buffer for the volume texture, though i might be
wrong here (surely depends on the amount of flames).

I am noob regarding the Blender code, but i am experienced in coding
c/c++/python/etc., so with a little help from the experts, i'm pretty sure i
can get this working.
What i have implemented so far:
    - simple cache structure for filaments (not really a cache yet, just a
buffer for control points and filaments)
    - some simplistic drawing of filaments in the 3d window (see here:
    - a "Fire" modifier and a physics panel (empty so far)
    - part of the control point simulation

I'd be glad for any support and constructive criticism :)
Thanks for this great software and all the astonishing art created so far!

Best regards
    Lukas Toenne

More information about the Bf-committers mailing list