Tresjs / cientos

Collection of useful helpers and fully functional, ready-made abstractions for TresJS
https://cientos.tresjs.org/
MIT License
288 stars 40 forks source link

Equivalent of Three.js's `InstancedMesh` #342

Open andretchen0 opened 9 months ago

andretchen0 commented 9 months ago

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

Sea-DH1 commented 9 months ago

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

andretchen0 commented 9 months ago

@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>
Sea-DH1 commented 9 months ago

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

andretchen0 commented 9 months ago

@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 commented 9 months ago

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

alvarosabu commented 8 months ago

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?

andretchen0 commented 8 months ago

@alvarosabu

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