/* Shader description goes here */
surface
translucency14(float Kd = 0.6,
Ks = 0.8,
roughness = 0.1,
translucence = 1,
Km_vein = 1, /* [1 5] */
vein_repeats = 1, /* [1 5] */
s_freq = 1, /* [1 5]*/
t_freq = 1, /* [1 5]*/
darkspot = -0.5, /* [-.5 .5]*/
s_density = 1, /* [1 5]*/
noise_amp = 1; /* [1 5]*/
color baseend = color(0.0,1.0,1.0),
base = color(1.0,0.0,0.2),
tip = color(1.0,1.0,0.0),
leaf_color = color(0.0,0.8,0.8),
hilitecolor = 1;
float tipbias = 1; /* [1 10]*/
string veinmap = "")
{
//color map
color surfcolor = spline((pow(s,tipbias)), tip, tip, tip, tip, tip, tip, tip, tip, tip, baseend, leaf_color, leaf_color, base, leaf_color, leaf_color, baseend, tip, tip, tip, tip, tip, tip, tip, tip, tip);
normal n = normalize(N);
normal nf = faceforward(n, I);
//spotiness
float spotty = noise (s * s_freq,t * t_freq);
spotty = (spotty + darkspot) * noise_amp;
Oi = Os;
color diffFront = Kd * diffuse(nf);
color diffRear = Kd * diffuse(-nf);
//Do we have a map?
float density = 1;
if (veinmap != "")
density = texture(veinmap, s /s_density, t / vein_repeats ) * Km_vein;
color diffTotal = diffFront + (diffRear * translucence * density );
diffTotal = diffTotal * Kd;
color speccolor = specular(nf, normalize(-I), roughness) * hilitecolor * Ks;
Ci = Oi * Cs * surfcolor * (diffTotal * Kd + spotty + speccolor);
}