/* Shader description goes here */
surface
translucency11(float Kd = 1,
translucence = 1,
Km_vein = 1,
s_freq = 1, /* [1 10]*/
t_freq = 1, /* [1 10]*/
amplitude = 1; /* [1 10]*/
color base = color(0.313,0.764,0.168),
tip = color(0.313,0.764,0.168);
float tipbias = 1; /* [1 10]*/
string veinmap = "")
{
//color map
color surfcolor = mix(base,tip,pow(t,tipbias));
normal n = normalize(N);
normal nf = faceforward(n, I);
//spotiness
float spotty = noise (s * s_freq,t * t_freq);
spotty = (spotty - 0.5) * amplitude;
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) * Km_vein;
color diffTotal = diffFront + (diffRear * translucence * density );
diffTotal = diffTotal * Kd + spotty;