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

WebGPU: Instancing #23835

Merged
merged 6 commits into from
Apr 5, 2022
Merged

WebGPU: Instancing #23835

merged 6 commits into from
Apr 5, 2022

Conversation

sunag
Copy link
Collaborator

@sunag sunag commented Apr 4, 2022

Description

Adding support to instancing and improvements in Matrix*Node and BufferNode of NodeMaterial.

Examples:

Mesh
https://raw.githack.com/sunag/three.js/dev-instance/examples/webgpu_instance_mesh.html

Skinning ( sharing the same Skeleton & animation )
https://raw.githack.com/sunag/three.js/dev-instance/examples/webgpu_skinning_instancing.html

image

image

This contribution is funded by Google via Igalia.

@sunag sunag added this to the r140 milestone Apr 4, 2022
@sunag
Copy link
Collaborator Author

sunag commented Apr 4, 2022

@mrdoob What do you think about the Skinning example? it doesn't follow the API exactly but it might be useful?


child.material = new Nodes.MeshStandardNodeMaterial();

child.isInstancedMesh = true;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, this is more or less a workaround until we figure out a better way to combine skinning + instancing. For now, I think it's okay.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, this is more or less a workaround until we figure out a better way to combine skinning + instancing. For now, I think it's okay.

What do you think about an API like this?

const instanceCount = 10;
const instancedObj3d = new InstanceObject3D( mesh || sprite3d || skinnedMesh, instanceCount );

scene.add( instancedObj3d  );

@sunag sunag merged commit e63acfc into mrdoob:dev Apr 5, 2022
@sunag sunag deleted the dev-instance branch April 5, 2022 03:29
abernier pushed a commit to abernier/three.js that referenced this pull request Sep 16, 2022
* WebGPU: instancing support

* add instancing examples

* update thumbnails

* cleanup

* cleanup

* use native inverseSqrt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants