|
f l a m e _ s h a d e r
The purpose of this assignment was to write a shader that would give the appearance of a real flame.
It was a requirement that our final outcome had to emulate our reference material.
Here is my reference material:
DISCLAIMER: Please be careful when experimenting with fire.
I had friends on hand ready to put the fire out should it react uncontrollably.
There is this one science experiment where an object is first dipped into water and then into rubbing alcohol and then is lit on fire.
While the rubbing alcohol burns, the water prevents the material from catching on fire. This can be done with many objects
including paper, fabric, and even the human body.
Rubbing alcohol by itself does not burn blue. However, if the rubbing alcohol is soaked onto an object, that object will burn blue.

Here are some interesting shots. These were shot in burst mode.
Here is some video footage. Please excuse the poor quality of the footage. The Cage requires a day in advance reservations for video
cameras and I was unable to check it out. These are from my own personal camera.
The first three clips are pieces of a toilet paper roll dipped in the rubbing alcohol and then lit.
The last clip is of the rubbing alcohol burning by itself. As you can see, the paper burns blue, but the alcohol itself burns normally.
In terms of writing the shaders for both the color and displacements, it was tough. I had to experiment with many times,
using many different ways. Finally, I was able to receive some help from past students who knew what they were doing.
With the shader, both the top and bottom of the flame creates a smooth wave that softly flickers. Originally, I had a simple noise function
set for the bottom but it didn't turn out the way that I wanted, so I used roughly the same code for both the top and bottom. However,
I had to add in some variables:
Oi = Oi * (1 - smoothstep(-t - Smooth2 + Height, -t + Smooth2 + Height, noise(pp * Freq * Freq2)-BottomHeight))*Freq3;
Oi = Oi * (2 + smoothstep(-t - Smooth2 + Height, t + Smooth2 + Height, noise(pp * Freq)-BottomHeight)*Freq3);
Oi = 1 - smoothstep(t - Smooth + Height, t + Smooth + Height, noise(pp * Freq));
Oi = Oi * (1 - smoothstep(t - Smooth + Height, t + Smooth + Height, noise(pp * Freq * Freq2)));
Oi = Oi * (2 + smoothstep(t - Smooth + Height, t + Smooth + Height, noise(pp * Freq)));
As you can see, there are three frequency values. One and two simulate the wave on the top of the flame, while
all three are responsible for the bottom part of the flame.
Here is the shader applied to a simple plane.

Originally, when I wrote my color script, I input colors that I wanted my flame to be. However, when I rendered it out, the colors were
way too blown out, so I had to change the colors as can be seen above. They may not look like the the reference colors, but after having
been run through the script, they looked decently close. For the displacement, I didn't want a lot of flickering or noise, as the
rubbing alcohol doesn't flicker that much. So I kept the values moderately close when I animated the displacement.

Here is a rendered still of my final shader.

And finally, a movie of the flame animated by keying the displacement values (left):
I have found another way to animate the flame. Referencing back to previous students' works as well as talking with several students in person,
I was able to create a locator and then use the Post Transform MEL attribute to attach it to the flame. Using "RiCoordinateSystem," I was able
to link the XYZ movements and scale of the locator to that of the flame. From there, I animated the locator over the course of 90 frames to come
up with the animation (right):
Finally, animated two more shots. The left is with the locator animated with the displacement added to the shader (left).
The one on the right is the same with as the one on the left, only the displacement is animated.
|