Contact Info

Glowing Signs Shader


Moving Cars Shader


12th Man Flag Shader

12th Man

Metal Shader


Wattle and Daub Shader
Tree Trunk Shader
Water Shader Rippling Water
Flame Shader Flickering Flame
Candle Flame Shader Step by step tutorial - 1 - 2 - 3 - 4 - 5

STEP 4: Opacity Shader (part 2)

The opacity shader applied to the NURBS sphere with several modifications:
One, the portion of the script that adds shadows to the diffuse color was removed. This has the same effect as setting incandescence to 1.0 on a Lambert in the Hypershade. A color was added and the Kd value was ramped up to 1.7 to create the overexposed effect.
Two, rimwidth and rimheight variables were added to create the translucent hollow in the center of the flame. When multiplied by t, they make a rim whose width changes based on how far up the flame it is.
Three, a second smoothstep was added to the calculation of Oi (again, based on t) to create the soft edge near the top of the flame.

Final opacity shader

n = normalize(N);
nf = faceforward(n, I);
float b = smoothstep(base, base + blend, t);
float dot = 1- nf.normalize(-I);
float rim = rimwidth * (2 - rimheight) * t *2;
float edge = 1-(rimwidth * t * 0.5);
color rimOpacity = mix(baseOpacity, topOpacity, b) * smoothstep(1 - rim, 1.0, dot);
color edgeOpacity = smoothstep(1 - edge, 1, 1 - dot/1.5);
Oi = edgeOpacity * rimOpacity;
surfcolor = mix(baseColor, topColor, b);
diffusecolor = Kd /* * diffuse(nf)*/;
Ci = Oi * Cs * surfcolor * diffusecolor;