Mixing it up with Renderman™.
A basic Renderman shader.
Date Created:Friday December 29th, 2006 03:41 AM
Date Modified:Thursday July 31st, 2008 10:14 PM
/*
*
* Author: Dan Lynch
*
*/
surface
d_surf
(
float Ka = 1,
Kd = 0.5,
Ks = 0.7,
roughness = 0.1;
color hilite = 1;
float frequency = 20;
float radius = 0.4;
)
{
normal nf, n;
color ambientcolor, diffusecolor, speccolor, surfcolor = .5, surfopac = Os;
float ss = mod(s * frequency, 1.0);
float tt = mod(t * frequency, 1.0);
float sDist = 0.5 - ss;
float tDist = 0.5 - tt;
float distance = sqrt(sDist * sDist + tDist * tDist);
float opac1 = noise(s*10,t*10);
n = normalize(N);
nf = faceforward(n, I);
color mix1=0;
if (ss < 0.5)
mix1 *= opac1;
else
mix1 = surfopac;
color mix2=0;
if(distance < radius)
mix2 = 0;
else
mix2 = surfopac;
Oi *= mix(mix1,mix2,float noise(t*10));
color map = texture( "s-wave.tdl", s, t, "width", 0.8 );
setcomp(surfcolor, 0, 1);
surfcolor = mix(surfcolor, map, s);
ambientcolor = Ka * ambient();
diffusecolor = Kd * diffuse(nf);
speccolor = Ks * specular(nf, normalize(-I), roughness) * hilite;
Ci = Oi * Cs * surfcolor * (ambientcolor + diffusecolor + speccolor);
}
Downloads:
Download: mixed_surface.sl 1 KB
Please login or Click Here to register for downloads
Mixing by Dan Lynch
is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 United States License
Based on a work at www.3daet.com
Permissions beyond the scope of this license may be available at http://www.3daet.com
