由 ChildPark » 14日 1月 2004年, 10:07
surface brown(
float Ka = 1,
Kd = 1,
Ks = 0.2,
roundhness = 1,
turbfreq = 8;
color newcol = color(0.4,0.29,0.1),
bgcol = color(0,0.1,0),
specularcolor = 0.4
)
{
point PP;
float turb, f;
float maxfreq = 2;
color final;
normal Nn = faceforward(normalize(N),I);
vector In = -normalize(I);
PP = transform("object", P) * turbfreq;
turb = 0;
for (f = 1; f < maxfreq; f *= 2)
turb += noise(PP * f);
final = mix(newcol, bgcol, turb);
Oi = Os;
Ci = Oi * final * (Ka * ambient() + Kd * diffuse(Nn) +
Ks * specularcolor * specular(Nn,In, roundhness));
}