(H8.0.488)
Let's see if I didn't screw something up here:
1. As I understand it, in Mantra, an “ambient” light (a light whose contribution is only accessible through the ambient() call) is one which sets L to zero (same as prman – no directionality). And the following shader works as advertised:
light vex_light_testamb(float intensity=1) {
Cl = intensity;
L = 0;
}
when tested with a surface shader like:
surface vex_surf_testamb() {
Cf = ambient();
}
all's good – a flat ambient color.
2. Now, if I wanted to add the option to have occluded ambient (as a light), I should presumably be able to do this:
light vex_light_testamb(float intensity=1; int samples=100) {
float occ=0; vector bent=N;
occlusion(occ,bent,Ps,normalize(N),“samples”,samples,“maxdist”,1e9);
Cl = intensity*(1.0-occ);
L = 0;
}
but it doesn't work (with either of the two occlusion() versions) – it gives a very faint result – as though it wasn't searching far enough, or started at the wrong Ps, or N was in the wrong space… something.
See the “Busted” image below (corrected to gamma=0.01):
3. But if I then change the light so that it has some directionality (L!=0)
light vex_light_testamb(float intensity=1; int samples=100) {
vector Ns=normalize(N);
float occ=0; vector bent=Ns;
occlusion(occ,bent,Ps,Ns,“samples”,samples,“maxdist”,1e9);
Cl = intensity*(1.0-occ);
L = Ns*1e-6; // <– *almost* zero…
}
and the surface shader to react to diffuse, since the light is no longer an ambient light
surface vex_surf_testamb() {
Cf = diffuse(normalize(N));
}
then things render as expected.
Of course, the problem is that now my light is no longer an ambient light

See “OK” image below.
It seems to me that something is clobbering N (or it just doesn't get initialized properly) when the light is set to “ambient mode” (L=0).

