# Is casting a shadow ray non-symmetric in pbrt?

According to the description in the book, Scene::IntersectP() "checks for the existence of intersections along the [passed] ray". This operatorion should be symmetric in the sense that if i1 and i2 are pbrt::Interaction's, then scene.IntersectP(i1.SpawnRayTo(i2)) should be true if and only if scene.IntersectP(i2.SpawnRayTo(i1)) is true.

However, I've encountered the following contradiction to this expectation: For two pbrt::Vertex's x1 and x2, pbrt::VisibilityTester{ x1.GetInteraction(), x2.GetInteraction() }.Unoccluded(scene) and pbrt::VisibilityTester{ x2.GetInteraction(), x1.GetInteraction() }.Unoccluded(scene) returned opposite values. Since VisibilityTester::Unoccluded does nothing else than calling Scene::IntersectP in the previously described way (see the description in the book), it seems like I'm missing something crucial here.

• Could it be due to numerical issues for ray-triangle intersection? – Hubble Feb 16 at 19:51
• @Hubble Well, hard to say, but I guess the error indeed depends on the surface the ray hits. – 0xbadf00d Feb 16 at 20:09
• I wouldn't be surprised if the visibility tester is inconsistent if you test on a scene with complex meshes with high-frequency details. Maybe try with two triangles facing each others, or reduce the robustness epsilon, and see if the problem is still there. – Hubble Feb 16 at 20:13
• @Hubble I don't know if you're familiar with it, but I've tested it with the "sample.pbrt" scene in PBRT which is as simple as possible: i.stack.imgur.com/txaN0.png. – 0xbadf00d Feb 16 at 20:25
• Huddle is certainly right: It might be due to numerical issues for the ray-triangle intersection. PBRT offset the spawned ray (github.com/mmp/pbrt-v3/blob/…) to avoid such issue. However, there is no silver bullet here. – Beltegeuse Feb 17 at 18:07