|
surface
bake_areas2(string bakename = "", texturename = "";
float ka = 1, Kd = 1)
{
normal Nn = normalize(N);
float a = area(P, "dicing"); // micropolygon area
float opacity = 0.333333 * (Os[0] + Os[1] + Os[2]); // average opacity
a *= opacity; // reduce area if non-opaque
color diffcolor =1;
color tex =1;
// Lookup diffuse texture (if any)
if (texturename != "")
tex = texture(texturename);
diffcolor = Cs * tex;
if (a > 0) {
bake3d(bakename, "_area", P, Nn, "interpolate", 1,
"_area", a, "Cs", diffcolor);
}
Ci = diffcolor * Os;
Oi = Os;
}
|