Monday, April 6, 2009

Shader 101

This is the final image of my external HD from renderman using
basic shader that was created in cutter and later imported to Maya.


This is the wire frame image from Maya.



I use 3 point lighting to lit the scene. I apply different colors and intensity.



I was doing a little bit of research on glowing shader. I try to tweak the original shader hoping to get the color is changing. Apparently, it does work but it seems the color on the object is changing now. Anyway here's my working .sl file.

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
/*Original Shader written by Micah Taylor*/

/*Shader tweak by Christian Tjahjono*/

surface
bulb ( float Ks = 1,
Ka = 0.8,
Kd = 0.8,
Ksilh = 0,
roughness = .1,
silhrough = 0.55;

color specularcolor = (0,0,0) )

{
/*surface normal one unit in length*/

normal n = faceforward(normalize(N), I);
vector i = -normalize(I);

/*calculation of the lighting components*/

float d = n.i;
color y = color(1,1.8,7);
color l = ambient() + diffuse(n);

/*calculation of the apparent surface color*/

Oi = 0.3*d;
Ci = Oi*mix(l, y, d);
}
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@


New glowing.sl :

/*Glowing Shader*/


surface glow

(
float Ks = 1.0,
Ka = 0.8,
Kd = 0.8,
roughness = 0.1;
color myColor = 1;
color specularcolor = 1)

{

/* Construct a forward facing surface normal */

normal n = faceforward(normalize(N), I);
vector i = -normalize(I);

/* Calculation for ambient diffuse and color */

float d = n.i;
color y = myColor * 2;
color l = ambient() + diffuse(n);

/* Calculation for the surface color */

Oi = 0.8*d;
Ci = Oi*mix(l, y, d);

}

A test render for the glowing shader .