cientos icon indicating copy to clipboard operation
cientos copied to clipboard

Equivalent of Three.js's `InstancedMesh`

Open andretchen0 opened this issue 1 year ago • 7 comments

Description

As a developer using TresJS, I would like an equivalent of Three.js's instancedMesh to improve performance.

Suggested solution

Drei's <Instances />

Alternative

No response

Additional context

No response

Validations

andretchen0 avatar Feb 05 '24 01:02 andretchen0

Hi, you can use TresInstancedMesh <TresInstancedMesh ref="instancedMesh" :args="[geometry, material, maxGeometryCount]" @click="instanceMeshClick" />

Sea-DH1 avatar Feb 06 '24 06:02 Sea-DH1

@Sea-DH1

Hi, you can use TresInstancedMesh

Sure thing. The idea is to bring it to Tres/Cientos so it's possible to do something like:

<InstancedMesh :count="1000">
  <Box>
    <TresMeshNormalMaterial />
  </Box>
</InstancedMesh>

andretchen0 avatar Feb 06 '24 13:02 andretchen0

@andretchen0 Well, I understand what you mean. I feel like I can help implement this component.

Sea-DH1 avatar Feb 07 '24 09:02 Sea-DH1

@Sea-DH1

Sure thing. If you're new to Tres, this particular issue might be a bit of a challenge, but you're more than welcome to give it a shot!

andretchen0 avatar Feb 07 '24 23:02 andretchen0

Hey @Sea-DH1 , are you interested in trying to make a component for InstancedMesh? If so, I'll assign you.

andretchen0 avatar Feb 11 '24 14:02 andretchen0

Hey @andretchen0 @Sea-DH1 we got a interesting feedback from @Dekier on Discord about creating an abstraction with Frustum Culling support https://stackblitz.com/edit/instancedmesh2-forest?embed=1&file=src%2Fmain.ts

Is this already on the scope of this ticket?

alvarosabu avatar Mar 04 '24 15:03 alvarosabu

@alvarosabu

Thanks! Looks interesting! That might be a nice way to approach things.

andretchen0 avatar Mar 04 '24 16:03 andretchen0