Dear Embree stuff,
First of all, my congratulations for your GREAT work!
I'm trying to modify intersect code of BVH2 and BVH4 intersectors, in order to make them find (and report) all intersections, not only the closest one.
Here's my modified code: http://pastebin.com/3226UBgd
At the moment I'm trying a simple cube geometry (4 faces, 12 triangles), so I can avoid to concentrate myself on the stack problem (reporting all intersections would need a dyamic stack, no a fixed upper bound of 1+3*BVH4::maxDepth). In addition intersection are not stored in a dynamic array, just "debugged" and printf'ed.
The steps I've done, in the intersectfunction are:
- removed the "if popped node is too far, pop next one" check
- all hit nodes are inserted in the stack
- at leaves nodes, the hit.t is set to ray.far (i.e. hit.t = ray.far)
Unfortunately it seems to not be enought (the cube geometry reports me only one intrsection).
Could you please help me? At the moment, I'm not looking at performance, just trying to make it work.
Many thanks in advance.