Respecting Batched Mesh Instance Visibility in three-gpu-pathtracer
Is your feature request related to a problem? Please describe.
Currently, When we have a Batched Mesh with let's say N Geometries and M Instances. Out of the M instances, we set the visibility to "off" for X of them. In a normal Three.js scene, that works perfectly and the instances aren't visible, but the same scene in three-gpu-pathtracer would render those visibility "off" instances.
I tried searching but seems like this feature doesn't exist?
Describe the solution you'd like
I think currently there's no direct translation from Batched Mesh to three-mesh-bvh? ( internal structure ), so certain properties like visbility flags aren't being utilized when pathtracing. It would be good to have a feature where the visibility also translates nicely
Unfortunately neither InstancedMesh nor BatchedMesh are directly supported by the project. Generally the way the path tracer works is all geometry is merged into a giant monolithic mesh for rendering (which isn't an ideal approach but is what's done right now) and that process doesn't account for Batch or Instanced Meshes. If you'd like to get things to work as-is you can convert the instanced or batched mesh to a "baked" version - basically a Mesh instance that has all visible subgeometry instances merged. Adding something like a top level acceleration structure would be the better solution but it likely won't be added until a WebGPU rewrite comes around.
Interesting!, I was under the assumption that it would be using something like a TLAS ( scene ) / BLAS ( meshes / composites ), meaning we can just skip a AABB and keep traversing further, allowing us to ignore the meshes we don't want.
Thank You, for the response.