Anyone who has seriously considered making
realistic fire knows how hard it is to get the
correct look and more importantly the correct
dynamic behavior. The problem can be tackled
in different ways: usually animators use particles
to simulate the motion and then various rendering
techniques to render these particles so that
they look like fire, this solution is used in
another tutorial on HyperVoxels.
Another way to see the problem is to consider
the fire as a purely fractal phenomenon and attempt
to simulate it just by using textures. There
is a well known technique that consists of applying
a fractal noise texture to a plane and move the
texture along the Y and Z axis to give it vertical
velocity combined with a turbulent like motion
(that comes from the motion along the Z axis).
That's a good solution mainly because it's fast,
but there are some obvious limitations, in particular
it is not possible to fly through the fire and
it can not be seen from any direction. Here we
propose a different method using a volumetric
distant light:
- Start Layout.
- Move the light to 0,-1,0 and set its orientation
to 0,-90,0. In the camera view the light should
be at the bottom of the screen facing upwards.
- Open the Light Properties panel. Toggle Volumetric
L ight and click on Volumetric Light Options.
Now you should be in the Volumetric options
panel.
- Open VIPER, render an image. For faster previews,
switch to draft mode.
- Click on Edit Texture. In the texture editor
set the Layer Type to Procedural Texture.
- From the volumetric light panel click on "Texture
Only". What that means is that the only thing
that we will see in the light is the texture.
This is usually better when trying to achieve
texture effects with volumetric lights.
- On the same panel increase the Luminosity
to 500%:
 |
- From the texture editor, set the Falloff
to 25% on Z. You should see the texture attenuated
along the axis of the light (always Z).
- To have something that looks like flames
we need to stretch the texture along the axis.
A ratio of 1/3 is usually good for this type
of effect. So let's set the X and Y Scale to
0.5 m and the Z Scale to 1.5 m.
- We have something that starts to look promising
though it's not of the right color. To set
the color, let's add a Gradient Layer, keep
the input parameter to "Previous Layer", this
way we can remap the values from the procedural
to what we want the fire to look like.
- Set the Alpha value for the first key to
0%. Now add 3 keys one at parameter 0.35, another
one at parameter 0.5, another one at parameter
0.65.
- Set the Alpha value for the third key at
100% and set its color at ( 244, 139, 023).
Now you should see a nice looking flame. Note
that by moving the keys you can change the
overall shape of the flames.
So now you should have a pretty decent looking
fire. What we did so far is just set a texture
and remap its values using a gradient. In the
gradients most of the keys are transparent except
one, which means that the fire will be mostly
transparent except for one key which creates
the orange flame like effect.
At this point we can experiment with different
parameters for turbulence and see how they affect
the fire, we can also change the procedural to
something different like crumple and see how
it looks like. But let's keep Turbulence for
the moment, what we need to do now is to give
the fire the motion it deserves.
A simple way to do it is just to add an envelope
on the Z position for the Turbulence layer. To
do this, select the Turbulence layer and click
on the Position tab. Activate an envelope for
the Z position by clicking on the E button. Add
a key at frame 60 with a value of 5 m. Render
an preview in VIPER (make preview). After everything
is rendered you should have a nice fire animation.
This is a good start but we miss a crucial
property of fire: there is no secondary motion
in the flames themselves, the fire looks very
well behaved and that's just not the way it is
in nature. To do that we can use the "Texture
Displacement" technique: by adding a texture
displacement before "Turbulence" and by animating
it we will get some really interesting secondary
motion:
- Add a Procedural Layer. Move it to the bottom
of the list, that makes it the first layer
in the process order.
- Set the number of frequencies to 2, that
will reduce the render time.
- Set the blending mode to "Texture Displacement".
Now what you should see is that the flames
are distorted. By setting the active state
of the layer on and off you can see how it
affects the overall texture. Another thing
that you can notice is that it increases the
render time significantly, that's because a
texture displacement is 6 times more expensive
than a regular layer.
- Now set the Z scale to 3 to keep the same
ratio and make the texture move along the Z
axis like the other one. The experience shows
that using a velocity which is 2 times the
velocity of the base layer gives some nice
results, so set an envelope on the Z position
with a key at frame 60 and a value of 10m.
Of course, this is a total heuristic with no
proven relation to any physical reality, but
at least it looks good.
That's it we now have a nice fire with secondary
motion going on, all that without the help of
any objects, particles or image sequences. The
big benefit of working with volumetric light
is that you can fly the camera around and through,
it will always render correctly. Here is a view
of the flame when the camera is facing the light:
Finally, we can change the look of the fire
so that it looks more like a heavy fuel fire
with more contrasted flames. For that we need
to make the fire more opaque and luminous which
is like increasing the density of the medium.
Set the values of luminosity and opacity to 5000
%:
The render time for the second animation is
higher than the first one, but we have the extra
realism of the texture displacement, so depending
on the level of realism you want to achieve,
you can tune your render times. One thing that
is important about volumetric lights is to make
sure that they are not using raytraced shadows
especially if you are working on a large scene,
unless you really need it. It is also important
to keep in mind that in this example, most of
the render time is being spent on the texture
evaluation, therefore optimizing the texture
is what's really important here. To optimize
a texture there are just a few simple rules to
follow:
- For procedurals the render time is directly
proportional to the number of frequencies (or
octaves), so use the right number of frequencies.
Try to see what happens if you reduce the number
of frequencies and if it's visually acceptable.
Reducing the number of frequencies will limit
the amount of detail, but usually high frequencies
details get lost in the image.
- Don't use a texture displacement if you don't
need it because it is an expensive operation.
- Limit the number of layers in your texture,
make sure that they are all useful.
|