/*
This light works as a directional light,
but instead of shadows, it creates occlusion.
NOTE: angle of incidence and coneangle
may create artifacts. be aware.
*/
light
wgsOcclusionLight(float intensity = 1,
samples = 64, /*[8 1024 1]*/
multiplier = 2, /*[0 10 1]*/
coneangle = 60,
clampocclusion = 1;
color lightcolor = 1;
string pntcloud = "";
)
{
vector direction = vector "shader"(0,0,1);
float occ;
solar(direction, 0.0) {
if(pntcloud != "") {
occ = 1 - occlusion(Ps, -direction, samples,
"pointbased", 1,
"filename", pntcloud,
"clamp", clampocclusion,
"coneangle", radians(coneangle)
);
}
else
occ = 1 - occlusion(Ps, -direction, samples,
"coneangle", radians(coneangle)
);
occ = pow(occ , multiplier);
Cl = occ * intensity * lightcolor;
}
}
//clamp stops occlusion from becoming too dark