|
surface
pt_occlusion (string bakename = "";
string hitsides = "front";
float maxdist = 1e15,
falloff = 0,
falloffmode = 0,
samplebase = 0,
clampocclusion = 1,
maxsolidangle = 0.05;
output varying float _occlusion = 0)
{
normal n = normalize(N);
normal nf = faceforward(n, I);
_occlusion = occlusion(P, nf, 0,
"pointbased", 1, // no raytracing required
"hitsides", hitsides, // "front","back" or "both"
"maxdist", maxdist, // normally a large distance
"falloff", falloff, // reduction with distance
"falloffmode", falloffmode, // rate of change of darkness
"samplebase", samplebase, // jittering
"clamp", clampocclusion, // prevent "blow-out"
"maxsolidangle", maxsolidangle);
if(bakename != "")
bake3d(bakename, "_occlusion", P, n,
"_occlusion", _occlusion );
Ci = (1 - _occlusion) * Os;
Oi = Os;
}
|