RenderKit / embree

Embree ray tracing kernels repository.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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, the tfar 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.