Fire Shader

The purpose of this project was to write a surface shader that would give a simple object the appearance of being an animated flame. As with the previous assignments, the emphasise was on the vital need to carefully observe and document a natural phenomena before creating a digital version of it.



Reference Photos


I lit up a candle, and took photographs with my Canon Powershot S3.

I had to set up the shutter speed and aperture manually,

but still could not get the results I want.

I probably need to use a better camera so I don't get as much noise.

As you can see, the flame contains layers of color: white, yellow, orange, and blue.

The gradation of color change is very interesting.



Reference Video

For the reference videos, I set my camera on a tripod,

and I first filmed a candle lighter.

I shot one video with light on, one in the dark.

The flame from the candle lighter is not very steady,

and I don't have some one to help me holding it,

so I decided to light up a candle instead.

That way I can be the cameraman and control how close I want to shoot it.

The candle flame was very steady because there was little air circulation,

so I had to blow some winds from a distance to make the flame dance a little.


Here is my analysis of the flame shape and color:



Shader Development

We obtained the scripts for fire shader in class,

and Malcolm explained what each source code line does.


I looked at past student works and found a few people who also did candle flames:

Kiki, Oohoo, Chee-Loong, Thidaratana Jonjai, and Yoon Jeong Han.


Gaki, who is my tutor, helped me analyzing what I need to create

to get the result I want (which is close to Thidaratana Jonjai's shader).


My original idea was to create two ovals or maybe use one crescent,

but the arc inside the flame is actually kind of flattened,

so I used smoothstep instead.

I first created the blue outlines by creating a blue circle,

then changed the transparency of the top and bottom.

Then I used smoothstep again to create one white circle for the flame,

one circle to act as the mask for transparency at the bottom center.

Finally, I duplicated the white circle for flame,

and used mix to changed the color to yellow and orange.


fire shader source code


I saved the renders I generated in Cutter,

which record the process of my shader development,

and made them into a movie:


Snap shot of my fire shader in Maya:


Renderman Rendering Result:



Setting up the scene

I recreated the scene in Maya, and made polygon models for the candle,

transparent CD and bamboo table mats.

I used Maya Live to set up the scene.

In my scene, I have 6 spot lights, 1 point light.

Two of the spot lights have negative values to take out brightness around the CD.

For the animation of the flame, Gaki gave me a script he wrote for cell division.

The script creates lattice deformer and animate lattice points randomly.


After generating animation with the script,

I also created another lattice to key frame the flickering motion of flame.

Moreover, I had to animate the position and intensity of the point light.


Mental Ray does a much better job render out the candle,

so I used Mental Ray to render candle and background,

used Renderman to render the flame.

Finally, I used Shake to composite them together.


Reference footage



After class critique, I modified the wax geometry to make it more irregular,

and Malcolm taught us how to add Renderman Attributes for Subsurface Scattering to shaders,

so I tried it out and I absolutely love how it makes the candle look much nicer.

I still need to play around more with the parameters for the SSS Renderman Attributes though.

The shader for the thin plastic case is also very tricky and needs more work.



Back to Top