surface
veins( float Ks=.5, Kd=.5, Ka=1, roughness=.1, Freq=3, Iter=2; color specularcolor=1 )

#define udn(x,lo,hi) (smoothstep(.25, .75, noise(x)) * ((hi) - (lo)) + (lo))

{
normal Nf;
vector V;
color Csnew;
float n1, x;
float n2 = 0;

/* define colors for spline */
color pink = (1.0, 0.855, 0.725);
color blue = (0.5, 0.2, 1.0);


/* calculate itterations of noise pattern */
for (x=1;x<=Iter;x+=1){
n1= smoothstep(.4,.6,noise(s*Freq*x,t*Freq*x));

/*enhance contrast in noise pattern & fill white with black*/
n2 = clamp (n2 + (smoothstep(0,(.09*x),n1) - smoothstep ((.1*x),(.2*x),n1)),0,1);
}

Csnew = spline(n2, pink, pink, blue, red, red);
Nf = faceforward( normalize(N), I );
V = -normalize(I);

Oi = Os;
Ci = Os * ( Csnew * (Ka*ambient() + Kd*diffuse(Nf)) +
specularcolor * Ks * specular(Nf,V,roughness) );
}
[BACK]