|
The fully shaded tree.
|
|
{
//color surfcolor = mix(Cs, tip, pow(t,expo));
//float smin = scenter-sminfactor;
//float smax = scenter-smaxfactor;
//color tipmult = smoothstep(smin,smax,t);
color surfcolor = mix(Cs, tip, pow(t,expo));
//color surfcolor = spline(t,tint,tint1,tint2,tint3,tint4,tint4);
normal n = normalize(N);
normal nf = faceforward(n, I);
Oi=Os;
color ambientcolor = ambient() * Ka;
color frontcolor = maincolor * Kdfront * diffuse(nf);
color backcolor = transcolor * Kdback * diffuse(-nf);
float mapvalue = 1;
if (specmapname != "")
mapvalue = texture(specmapname);
color speccolor = specular(nf, normalize(-I), roughness) * mapvalue * Ks * highlight;
//color speccolor = 0;
//float r = random();
//if(r > 0.5)
// speccolor = 1;
//else
// speccolor = 0;
Ci = Oi * Cs * surfcolor * mix (frontcolor, backcolor, backlight) + ambientcolor;
}
|