Community
cancel
Showing results for 
Search instead for 
Did you mean: 
AndrewC
New Contributor I
201 Views

Ray fails to intersect at corner of triangle

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 Kudos
6 Replies
SvenW_Intel
Moderator
201 Views

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.

AndrewC
New Contributor I
201 Views

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?

AndrewC
New Contributor I
201 Views

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.

 

AndrewC
New Contributor I
201 Views

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.

SvenW_Intel
Moderator
201 Views

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.

 

 

AndrewC
New Contributor I
201 Views

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'.

Reply