Simple Fire Model
When I initially started working on this project my intent was to
model fluid motion and advection to create a realistic physically
based model of flame and related phenomenon as in [3]. However a
stable and accurate numeric simulation is extremely difficult
and computationally taxing to produce.
Given the remaining time, I chose to implement the field of gas flow
as a smoothed three dimensional noise field interpreted as a vector
function, generated in a manner similar to [1]. Since this is graphics
and not physics, the matter of primary importance is generating
turbulence which looks realistic and connotes fire, rather than
exploring the physical behavior of gases.
This low frequency noise field is used as force vector to accelerate
particles injected at the base of the fire. The smoothness properties
of the field provide some continuity between the motion of adjacent
particles.
Flow Field
The flow field is constructed by repeatedly applying a 3 dimensional
gaussian function to each of thee component noise vectors. To simplify
edge case processing, this smoothing is done using periodic boundary
conditions. At each step, the a new noise sample is computed, and it
is blended with the existing function using an exponential moving
average, which generates a smoothly varying vector field over time.
To minimize the cost of updating the field, the flow field is linearly
interpolated through time between two steps of noise addition. This
turned out to be considerably less important once I changed the
smoothing to 3 applications of a single dimensional filter rather
than a full 3d psf.
Particles
Each particle consists of a position, velocity, and temperature.
They are injected into the system in a uniform distribution about a
disk at the bottom of the model volume. The initial velocities of
particles are strictly vertical, with a magnitude which depends
on the radius.
At each time step normal newtonian motion is applied, and the
particle is cooled. In order to approximate the heat distribution,
particles further out along the radius cool more quickly. Once the
temperature of the particle has reached zero, then it is removed from
the system.
The temperature is used to color the particle. As each particle
is drawn it is used as the interpolation parameter for a piecewise
linear function which goes from yellow-white to yellow, to dark
red, and finally to black. During this last stage the alpha value
for the particle is interpolated to zero.
Blobs
The particles are rendered as semi-transparent blobs. Each blob
attempts to approximate a transparent ellipsoid in three dimensions
by a transformed gaussian function in image space, centered at
the position of the particle. As rendered, each blob consists
of a rectangular array of (r,g,b,a) pixels. At each of these
pixels the gaussian function is sampled.
This function mapping is scaled by the velocity of the particle, and
rotated so as to orient along the velocity vector. The output
of this function is used as the alpha value of the resulting
pixels in the array, and composited into the image.
Rendering
In order to properly render the transparency of the particles, I
maintain a list of all blobs which contribute to each pixel. Each
contribution contains a full list of (r,g,b,a,z). As each particle
is processed during the rendering phase, the contributions are
placed into a per-pixel priority queue sorted by depth. Once all the
contributions have been calculated, the priority queue is emptied
in order and each contribution is composited against the total
pixel color so far.
To limit allocation overhead, pixel contribution structures are
allocated as the priority queue grows, and are never deallocated.
The major drawback to this approach is not as much speed as memory
consumption. For the sample sequences done for this project the pixel
blending buffers occupied as much as 40MB. One good optimization would
be to keep track of the the shortest distance which is opaque beyond
some distance threshold and throw away pixels behind it. Another might
be to composite pixels directly if they are sufficient close, and
suffer the small amount of resulting error if another new pixel came
between them. Neither of these two optimizations work very well with
the current priority queue structure.
Obviously a different approach would need to be taken in a raytracing
environment. This would most likely require rendering the particle
set into an initial voxel space using alpha compositing, then sampling
this space with the rays.
Considerable savings could be gained by direct composition, ignoring
global depth ordering, in models where occlusion doesn't play a
significant role in the final result.
Model Parameter Summary:
- particle injection rate
- particle injection distribution
- particle size in image space
- interpolation of (r,g,b,a) based on temperature
- distribution of initial velocities
- rate and geometry of temperature change
flow field parameters:
- volumetric sampling density
- smoothness
- magnitude of force applie
- rate of change (number of interpolated frames and averaging weight)
All of the runs below used a bottom particle injection rate of
60 per frame
a basic fire model. actually the higher contrast version on the right
looks better, even without the black "smoke"
the same model, but with an increased force magnitude and smoother
flow field. the fire is considerably more turbulent and exhibits
larger flame tongues. note the horizontal 'artifacts' caused
by excess deflection of vertical motion
The scene is not quite so interesting from above, due to the sparsity
of particles and the fact that the primary velocity component for the
fire is along the vertical axis
Use of a smoother flow field and lower velocity gives a much 'smaller'
seeming fire, with no large random gouts of flame.
a different parameterization does a reasonable job of creating the
illusion of water vapor
Extensions
Particle systems are a general technique which can model a variety
of dynamic phenomenon. The parameterization of this model is sufficient
to allow extensions in several directions.
- model for gusting crosswind
- different density and color properties for different effects
(smoke, etc)
- tie in to simple combustion model and scene geometry
- optional use of axisymmetric flow field to better
match domain geometry
- it should be possible to build a noise blending technique which
could generate periodic smooth noise fields. this would allow
iteractive use for most small models.
- "explosion" using:
- spherically symmetric initial forces
- mixture of initial flame-like colors with grey, white,
and brown opaque smoke
- natural advection force
One concern with further application of this model to different
phenonmenon is the potential requirement for a large number of
particles. Fine detailed and smooth smoke, such as from the end of a
cigarette, may require a huge number of particles to accurately
sample the field. At that point it may be considerably more effective
to model the flow phenonmenon and trace them directly as in [3].
references
[1] K. Perlin, "An Image Synthesizer", SIGGRAPH '85
[2] W.T. Reeves, "Particle Systems. A Technique for Modeling a Class of
Fuzzy Objects", SIGGRAPH '83
[3] Jos Stam, "Depicting Fire and Other Gaseous Phenomena Using
Diffusion Processes", SIGGRAPH '99