Click on mesh and get coordinates - raycasting x BVH

Hi guys, we have a problem: we need to estimate click coordinates on a complex mesh (1M+ vertices, 3D scans). Simple raycasting is working, but of course is very slow. So we have tried BVH. It works great, but a problem here is its memory intensive and causing mobile devices to crash. As we need only to estimate the click coordinates it looks to me like an overkill to use BVH magic. So my question, isnt there any way how to make basic raycasting faster for this purpose (estimating click coordinates)? We do not need the performance of BVH, just a bit faster raycasting. Could someone help please?

I am no expert in this field, but have you tried creating a bvh using simplified geometry, or creating hitboxes?

Here is a demo of a photogrammetry model. Since the model had many vertices, raycasting was slow. So I created a hit box around it that roughly estimates the wall boundaries. No need to use BVH.

Double click the wall to change the OrbitControls target.

1 Like