ambient include / exclude options (-ae, -ai, -aE, -aI)

Hi all,

I had a closer look at the behaviour of the ambient exlude option -ae,
which is one of several tweaks for detail geometry in large scenes.

I set up a very simple test scene. A box 1 x 1 x 1 is indirectly lid by
a surface below the ceiling, pointing up. The walls of the box are
assigned a material "copy", which inherits its properties from a
lambertian plastic material "original". A sensor records illuminance
below that light source, which means that it should receive only light
reflected back from the box surfaces. I run rtrace four times:

a) direct only:

rtrace -ov -I+ -h -ab X -av 0 0 0

This should give a zero reading, as the luminous (upper) surface of the
light source is not directly visible.

b) direct+indirect:

rtrace -ov -I+ -h -ab 3 -av 0 0 0 test.oct

This should give a reading of the light reflected by several bounces
from the ceiling and walls of the box.

c) direct+indirect with -ae original:

rtrace -ov -I+ -h -ab 3 -av 0 0 0 -ae original test.oct

This should give the same result as b), as excluding the original
material definition, which is not applied to any surface, should not
affect the ambient calulation.

d) direct+indirect with -ae copy:

rtrace -ov -I+ -h -ab 3 -av 0 0 0 -ae copy test.oct

This should give a zero reading, just as case a), as the light can be
received only by the diffuse walls, which have their modifier excluded
from the ambient calculation.

Initial expectations:
a) = d) = 0
b) = c) < 0

The results are:
a) 0.000000e+00 0.000000e+00 0.000000e+00
b) 3.035680e-03 3.035680e-03 3.035680e-03
c) 3.203512e-03 3.203512e-03 3.203512e-03
d) 2.749251e-03 2.749251e-03 2.749251e-03

The difference between c) and b) is due to the default sampling
algorithm, so switching to -u- leads to equal values:

a) 0.000000e+00 0.000000e+00 0.000000e+00
b) 3.159767e-03 3.159767e-03 3.159767e-03
c) 3.159767e-03 3.159767e-03 3.159767e-03
d) 2.845761e-03 2.845761e-03 2.845761e-03

Still, d) is obviously non-zero. Why? So is that 2.85 the result of the
diffuse-direct calculation, which is not affected by the -ae option?
That would mean that even though specularity is zero, rays reflected
from the (invisible) test surface introduced by the -I+ switch towards
the ceiling receive a value from there, which results from the direct
calculation at the ceiling. Setting all -ab 1 leads to an identical
result for a), b), c) and d):

b1) 2.845761e-03 2.845761e-03 2.845761e-03

Now, the one ambient bounce is "used up" by the reflection from the test
surface introduced by -I+, rays send out from there only return values
from the direct calculation at the next intersection point.

I hope my conclusions are correct. If they are, it may useful to share
this for others looking into using the ambient include / exclude options.

Cheers, Lars.