/*
Example shader for point-based occlusion.
Raytracing is not required.
Refer to the Pixar document, pointbased.html
The source code for these shaders was taken
from Pixar's AppNotes.
*/
surface
wgsBakePTC(string bakename = "";
{
normal Nn = normalize(N);
float a = area(P, "dicing"); // micropolygon area
color areaval;
// average opacity
float opacity = 0.333333 * (Os[0] + Os[1] + Os[2]);
a *= opacity; // reduce area if non-opaque
if(a > 0)
bake3d(bakename, "_area", P, Nn,
"interpolate", 1, "_area", a);
//we can add more data to bake if we want, like N
// bake3d(bakename, "_area,N", P, Nn,
// "interpolate", 1, "_area", a, "N", Nn);
Ci = Cs * Os;
Oi = Os;
}