Intel® Embree Ray Tracing Kernels
Discussion forum on the open source ray tracing kernels for fast photo-realistic rendering on Intel® CPU(s)
287 토론

Ray fails to intersect at corner of triangle

AndrewC
새로운 기여자 III
2,236 조회수

I have a half/sphere geometry , radius 1, of about 325 triangles. The triangular geometry is properly connected with no overlapping/'duplicated' nodes. I am firing rays from the origin towards the surface of the sphere. As a test of robustness I set up the rays to be directed towards the 3D "nodes" that make up the geometry. I am finding some ( say 1-2%) of the rays are recording "no hit". Obviously there is a question of geometric robustness when a ray is hitting right at a 3D node shared by maybe 4 triangles. But I thought embree would be particularly robust when dealing with this type of problem. What am I missing here? I am using 2.16.5

 

0 포인트
6 응답
SvenW_Intel
중재자
2,236 조회수

You are likely using the default fast mode, which does some optimizations that reduce precision. Please set the RTC_SCENE_ROBUST mode and try again.

0 포인트
AndrewC
새로운 기여자 III
2,236 조회수

Adding the flag RTC_SCENE_ROBUST helped. It reduced the number of "misses" from 20 to 2. Sadly 0 is the only acceptable result. The attached image shows one point which one ray 'missed'.

Should I try upgrading to to 2.17.2?

0 포인트
AndrewC
새로운 기여자 III
2,236 조회수

attached is the half sphere as an STL

Ray that "misses" has origin 0,0,0. Direction -0.000000028097142    0.642787635000000    0.766044438000000

But I full expect that numerical precision changes when going from text will mean that the issue is not easy to reproduce.

 

0 포인트
AndrewC
새로운 기여자 III
2,236 조회수

Upgrading to 2.17.2 did not make any difference to this issue. There are many use cases that require the intersection routines to be geometrically robust. I understand how a point on a boundary could be missed, but this ray is intersecting the geometry at a  location where a number of triangles meet. It is indeterminate which triangle should be selected, but it should pick one.

0 포인트
SvenW_Intel
중재자
2,236 조회수

The robust ray/triangle intersector used by Embree uses a consistent edge test (consistent for neighboring triangles) and conservative ray/box intersection during traversal. This algorithm makes the mesh ALMOST watertight, in particular along the edge where most algorithms have problems. However, exactly at the vertex there can still be issues.

A fix could be to add a small epsilon at kernels/geometry/triangle_intersector_pluecker.h, by replacing minUVW >= 0 | maxUVW <= 0 by minUVW >= -eps | maxUVW <= +eps.

 

 

0 포인트
AndrewC
새로운 기여자 III
2,236 조회수

OK, I do notice that it does work well along the edge. Now I know where to look, I can go into at the code and make the suggested change to see if this fixes my issue. I would suggest this change should be rolled into the master branch for 'robust mode'.

0 포인트
응답