Woody_VOPs network

Woody function은 기본적으로 Collapse하여, 라이브러리 타입으로 보이실겁니다. 보여줄려면 다 보여주지, 왜 이것만 보여주냐고 생각하실 수 있는데, 나머지는 스터디에서 다루도록 하겠습니다. 다음은 렌더맨코드입니다.

color woody()
{
extern float u, v;

float rings = 6,
loops = 2,
stretch = 0.75;
color darkcol = color (0.3, 0.221, 0.165),
lightcol = color (0.7, 0.551, 0.408);

float uu, vv, indx;
uu = loops * u;
vv = v + stretch * sin( uu * PI );
indx = mod( vv * rings, 1 );

return mix( darkcol, lightcol, 1 - indx*indx );
}

surface layershader(
float Ka = 1,
Kd = 0.9,
Ks = 0.4,
roughness = 0.12
)
{
color layer1, layer2, surfcol;

normal Nn = normalize(N);
vector In = -normalize(I);
float layindex = texture( "smash.tex"[3], u, v );

layer1 = woody();
layer2 = texture( "mandril.tex", u, v );

surfcol = (1 - layindex) * layer1 + layindex * layer2;

Oi = 1;
Ci = surfcol * (Ka*ambient() + Kd*diffuse(Nn)) +
Ks * specular(Nn,In,roughness);
}

코드출처: cade.scope.edu