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
As a developer using TresJS,
I want a straightforward way to enable a bounding volume hierarchy (BVH) on my 3D meshes and geometries,
so that I can benefit from drastically improved raycasting performance and more efficient collision detection in complex scenes.
Reason / Use Cases
Performance Gains: A BVH can accelerate raycasting operations, especially for large/complex geometry.
Collision Detection: Many real-time applications (e.g. games, simulations) need fast collision checks; BVH can help optimize these.
Simplicity & Consistency: Having a composable approach in TresJS aligns with the rest of the API, keeping logic encapsulated and Vue-friendly.
Suggested solution
In the appropriate module (e.g.,/useBVH.ts or similar), we could provide:
import{ref,onMounted}from'vue'// Possibly import { MeshBVH, MeshBVHVisualizer } from 'three-mesh-bvh' // or any relevant utility from three-mesh-bvhexportfunctionuseBVH(geometryRef){constbvhRef=ref(null)onMounted(()=>{// Pseudocode: // 1. Create or update the BVH// 2. Store the result in bvhRef// 3. Optionally expose utilities for intersection, collision checks, etc.// Example:// bvhRef.value = new MeshBVH(geometryRef.value)})// Return whatever is helpful for the user:// e.g. the BVH instance, methods for raycasting, collision checks, etc.return{
bvhRef,// raycastWithBVH, collisionCheck, etc.}}
Reactive Updates
Optionally watch for changes in the provided geometry or the mesh and re-build BVH if necessary.
Alternative
No response
Additional context
Potentially wrap three-mesh-bvh or another library under the hood.
Consider how to handle dynamic geometries versus static ones (e.g., partial updates vs. full rebuilds).
Align the API style with other TresJS composables (useXyz naming, returning refs or methods, etc.).
Description
As a developer using TresJS,
I want a straightforward way to enable a bounding volume hierarchy (BVH) on my 3D meshes and geometries,
so that I can benefit from drastically improved raycasting performance and more efficient collision detection in complex scenes.
Reason / Use Cases
Performance Gains: A BVH can accelerate raycasting operations, especially for large/complex geometry.
Collision Detection: Many real-time applications (e.g. games, simulations) need fast collision checks; BVH can help optimize these.
Simplicity & Consistency: Having a composable approach in TresJS aligns with the rest of the API, keeping logic encapsulated and Vue-friendly.
Suggested solution
In the appropriate module (e.g.,
/useBVH.ts
or similar), we could provide:Tip
Check R3F Drei's implementation https://drei.docs.pmnd.rs/performances/bvh
Reactive Updates
Optionally watch for changes in the provided geometry or the mesh and re-build BVH if necessary.
Alternative
No response
Additional context
Validations
The text was updated successfully, but these errors were encountered: