-
-
Notifications
You must be signed in to change notification settings - Fork 35.4k
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
From InstancedMesh to more generic Instances #25078
Comments
I would generally love an API design that gives more control of the rendering/culling process by putting the implementations for gathering the render lists and making draw calls into methods of the specific classes, so the component can decide how to handle it, if static or dynamic. I made a class for instanced skinnning with individual animation states (also with geometry LOD, culling and automatic bone reduction/skin-remapping LOD) Other than InstancedMesh regular SkinnedMesh instances are linked to this component and the SkinnedMesh is not removed from the scene hierarchy and can be nested anywhere. This way the component handles the batching witch culling and LOD automatically, while instancing for the meshes can be turned on/off seamlessly. The most expensive part for SkinnedMesh is the animation and matrices computations which, without a LOD system, makes instancing not really a benefit as performance likely suffers earlier from that than draw calls. There often is a need that you need to render a instance individually again, like highlighting in a emissive color without making that an additional attribute. So a flexible variant to switch between makes it much more intuitive.
I think separating between "Instanced" and "SkinnedInstanced" would be enough, the only complexity difference is there i suppose. |
Anything that makes this use case more streamlined has my vote. |
Is your feature request related to a problem? Please describe.
Three.js has
InstancedMesh
API to allow easy GPU instancing handling.It extends
Mesh
and the constructor takesgeometry
,material
, andcount
.Because of this design, it has limiation. It is hard to make the use of GPU instancing with non-regular
Mesh
, eg.SkinnedMesh
,Line
, orPoints
.Describe the solution you'd like
We support more generic GPU instancing API.
Perhaps
Instances( Mesh|SkinnedMesh|Line|Points (or whatever), count )
.It would be more flexible.
Describe alternatives you've considered
Instanced
API for each object type. eg.InstancedSkinnedMesh
,InstancedLine
,InstancedPoints
. But I don't think it's a good idea because of complexity.InstancedBufferGeometry/Attribute
and they can be used for non-regularMesh
es (?). But it may be harder to use for generic users.Additional context
The idea is from
The text was updated successfully, but these errors were encountered: