Contact Info

Glowing Signs Shader

Glowing
Signs

Moving Cars Shader

Moving
Cars

12th Man Flag Shader

12th Man
Flag

Metal Shader

Corrugated
Metal

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 3: Opacity Shader (part 1)

To give the flame soft edges, we need a surface shader that calculates opacity based on the angle between the viewing vector and the surface normal.


Basic shader test

n = normalize(N);
nf = faceforward(n, I);
float noiseBase = base + (noise(s)-0.5);
float b = smoothstep(noiseBase, noiseBase + blend, t);
float dot = 1- nf.normalize(-I);
Oi = mix(baseOpacity, topOpacity, b) * smoothstep(1 - rimwidth, 1.0, dot);
surfcolor = mix(baseColor, topColor, b);
diffusecolor = Kd * diffuse(nf);
Ci = Oi * Cs * surfcolor * diffusecolor;

< PREV NEXT >