
Text hb_plastic.sl prepare.rib interact.sl interact.rib Makefile

surface hb_plastic(
float Ks = 0.5;
float Kd = 0.5;
float Ka = 1;
float roughness = 0.2;
color specular_color = 1;
output varying color _Cambient = 0;
output varying color _Cdiffuse = 0;
output varying color _Cspecular = 0;
output varying float _roughness = 0;
output varying point _P = 0;
output varying normal _N = 0;
)
{
_Cambient = Cs*Ka;
_Cdiffuse = Cs*Kd;
_Cspecular = specular_color*Ks;
_roughness = roughness;
_P = transform("world", P);
_N = normalize(ntransform("world", N));
N = normalize(N);
Oi = Os;
Ci = Os * (_Cambient*ambient() +_Cdiffuse*diffuse(N)
+ _Cspecular*specular(N, -normalize(I), _roughness));
}
|