|
Text hb_plastic.sl prepare.rib Makefile interact.sl interact.rib surface hb_plastic( float Ks = 0.5; float Kd = 0.5; float Ka = 1; float roughness = 0.2; color specular_color = 1; ) { varying color Cambient = Cs*Ka; varying color Cdiffuse = Cs*Kd; varying color Cspecular = specular_color*Ks; varying float Froughness = roughness;
uniform float stream_start = hb_interact_stream();
varying float stream_control = 0; varying float stream_point = hb_interact_stream("control", gridpattern("concentric",stream_control));
stream_point += hb_interact_stream("P",transform("world",P)); stream_point += hb_interact_stream("N",normalize(ntransform("world",N))); stream_point += hb_interact_stream("Cambient",Cambient); stream_point += hb_interact_stream("Cdiffuse",Cdiffuse); stream_point += hb_interact_stream("Cspecular",Cspecular); stream_point += hb_interact_stream("Froughness",Froughness);
N=normalize(N);
Oi = Os; Ci = Os*(Cambient*ambient() + Cdiffuse*diffuse(N) + Cspecular*specular(N,-normalize(I),Froughness)); } |