HELP: inconsistency between examples and the documentation
matthiascy opened this issue · comments
According to the documentation of rtcOccluded1
:
When no intersection is found, the ray data is not updated. In case a hit was
found, thetfar
component of the ray is set to -inf.
But in most examples, tfar
is still being tested against 0.0f
:
rtcOccluded1(data.g_scene,RTCRay_(shadow),&sargs);
// ... omitted
/* add light contribution */
if (shadow.tfar >= 0.0f) {
// some other code ...
}
Should I follow the documentation or tutorials?
Initialize tfar to some value >=0. After rtcOccluded call you can test for no hit found by either tfar >= 0 or tfar != -inf. Both tests are equivalent.