You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I was trying to implement Bvh via drei's abstractions and realized that it may not work with a vertex shader driving transformations on the mesh I'm trying to compute bounds for. After some snooping I saw that this issue might be tracking it already. Can I ask if that is the case or if maybe I am going about it wrong?
Screen.Recording.2023-02-03.at.12.24.06.AM.mp4
Basically in my r3f scene I'm shaping it like this demo one:
useHelper(ref, MeshBVHVisualizer)
...
<Bvh>
<Rays>
<mesh raycast={() => null} ref={ref}>
<planeGeometry />
<CustomShaderMaterial /> <---- driving the mesh deformation, scale, and rotation in vertex shader here
</mesh>
</Rays>
</Bvh>
This project is looking really amazing, so hats off @gkjohnson! Is there another approach I can take where three-mesh-bvh is compatible with custom vertex shader in the scene?
Is there another approach I can take where three-mesh-bvh is compatible with custom vertex shader in the scene?
Unfortunately no - the BVH is built is and queried on the CPU so any vertex transformation dynamically generated on the GPU are inaccessible on the CPU unless its been written to a buffer and transferred back which is what this issue suggests. The only other alternative is to perform all your vertex transformations on the CPU, instead.
If you'd like to work on a class that enables this as a contribution I'd be happy to provide guidance.
This project is looking really amazing, so hats off @gkjohnson!
This is very easy with and possibly the optimal use-case for transform feedback, which captures the primitive assembly of the vertex shader. Can either stay on the GPU like I do here, or be readback onto the CPU. Needs a patch to three to access GPU buffers mrdoob/three.js#26777, or use of GLBufferAttribute.
See https://twitter.com/edankwan/status/1518294689400725507
The text was updated successfully, but these errors were encountered: