In a case I'm working on, I am dealing with high values for tfar compared to the dimensions of my triangles. This results in precision problems, specifically around edges.
Thus, I am thinking about using double precision for ray/triangle intersection. What do you think would be the best approach? For now, I'm considering implementing a user geometry and implementing the Pluecker algorithm with double precision vertex coordinates.
Using a user geometry to do the job should work. You would then still have vertices as float as well as u,v,t?
Could you describe the problem you face in some more detail? As you mention issues around edges, I assume you see rays tunneling through the mesh at an edge?
Currently, my mesh is described using double precision out of Embree. I think that doing the intersection test using double precision should be enough to avoid the problems I'm describing.
These are, for example, two hits near an edge between two triangles with the following characteristics :
Hit 0 :
tfar = 1000;
u = 0.5
v = 5e-4
primID = 0
Hit 1 :
tfar = 1000
u = -5e-4
v = 0.5
primID = 1
Both these hits verify the condition from triangle_intersector_pluecker.h :
(minUVW >= -eps) | (maxUVW <= eps)
I could choose to eliminate one of the two intersections (which, in this case, are equivalent) when tfar0 ~ tfar1.
However, this would result in missed intersections when two triangles from the same geometries overlap (and in this case, I need to have both the intersections).
Thus, the whole problem consists in deciding whether a ray hit an edge of hits two overlapping triangles, which is problematic when hit distances become high enough to reach the precision limits of the float 32 type.