Closed mariuszhermansdorfer closed 1 year ago
I can take a look at this over the next few weeks (really busy now, and it's a bit of work).
There is a method to add a mesh to the bvh, and if you know ahead of time which parts of your mesh will be modified, you can use the meshid to add and ignore certain meshes.
But I think there is another method in embree we can use for dynamic, but it will take some effort to port it. I remember it will also make rays a bit slower because of how it handles a changing bvh , so I need to add more flags or a new method etc
Appreciate it!
I searched a bit and here are my initial findings:
RTC_BUILD_QUALITY_REFIT
https://github.com/embree/embree/blob/489b746c0d5010e0da10345e9dc96768bec9a037/tutorials/dynamic_scene/dynamic_scene_device.cpp#L121-L122Somewhat related to this feature request, I had to identify the primitive Id of the hit mesh (essentially its face index) and added these changes to the dev branch: https://github.com/cadop/dhart/pull/51/commits/ed722e0786f5e18b5cc8c5a3c7911fd981eac1ea
Let me know if they should go somewhere else.
You are really moving along!
Yes the dynamic scene is what I was mentioning, but there is a bit more to it for dhart. Since you are getting into the weeds and moving faster than I can comment on, some considerations to keep in mind for what will need to happen...
None of this is saying we can't do it, just some things I hope you can keep in mind when modifying so it is easier/faster for me to go through the PR
Thanks for working on all these features!
Use case description:
I'm working with a large mesh (500.000 quads) against which I constantly cast single rays from mouse cursor's position. This mesh is then modified while the mouse moves. At any given time only a few dozen vertices are affected. Only vertex position changes, face indices remain unchanged.
Wish
I'd like to be able to keep the existing BVH and only update a subset of vertices.
@cadop, do you have any ideas on how to approach this?