Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

StaticGeometryGenerator: Add support for InstancedMesh #419

Open
gkjohnson opened this issue Apr 24, 2022 · 5 comments
Open

StaticGeometryGenerator: Add support for InstancedMesh #419

gkjohnson opened this issue Apr 24, 2022 · 5 comments
Labels
enhancement New feature or request
Milestone

Comments

@gkjohnson
Copy link
Owner

gkjohnson commented Apr 24, 2022

No description provided.

@gkjohnson gkjohnson added the enhancement New feature or request label Apr 24, 2022
@gkjohnson gkjohnson added this to the v0.x.x milestone Apr 24, 2022
@timoisalive
Copy link

Hi!

Any news or plans on supporting InstancedMeshes?

And meanwhile, is there maybe an example somewhere how to use InstancedMeshes without the library support?

@gkjohnson
Copy link
Owner Author

This issue is about StaticGeometryGenerator. BVH already works with individual InstancedMesh instances.

@timoisalive
Copy link

This issue is about StaticGeometryGenerator. BVH already works with individual InstancedMesh instances.

Ok, sooo should I be able to create the collider without StaticGeometryGenerator?

I'm new to Three JS (and 3D in general), this is how I was able to generate the collider for my React Three Fiber group:

      new Octree().fromGraphNode(groupRef.current)

      const staticGenerator = new StaticGeometryGenerator(groupRef.current)
      staticGenerator.attributes = ['position']

      const mergedGeometry = staticGenerator.generate()
      mergedGeometry.boundsTree = new MeshBVH(mergedGeometry)

      const collider = new Mesh(mergedGeometry, new MeshBasicMaterial())

This doesn't however work with instancedMesh instances. Maybe I'm doing it all wrong...?

@gkjohnson
Copy link
Owner Author

Okay I see - yes it's correct that they are not supported with that function. You can manually convert the instanced mesh to one giant mesh but it is likely memory intensive. A separate top level acceleration structure would be best for handling something like instancing but that's not supported at the moment. If you'd like to try converting the instance mesh to a single geometry I recommend asking at the three.js forum.

@timoisalive
Copy link

Ok, thanks for the info! 🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants