troisjs / trois

✨ ThreeJS + VueJS 3 + ViteJS ⚡

Home Page:https://troisjs.github.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Performance with large number of geometries

garma83 opened this issue · comments

commented

Hi,

This is mainly a warning for future users I guess.. Im happy to contribute but the original creator seems to have abandoned this package.

Anyway, the FAQ states that this package is just as performant as Three.js. This is not my experience in practice. The package creates geometries and meshes with large amounts of props, and attaches watchers to all of them. That is fine and even convenient for limited number of objects. But for scenes with more than 100 objects, mounting/dismounting the scene caused a lag of multiple seconds, even though three.js has no problem with it.

InstancedMesh can be a solution, but for situations where the objects are not the same (custom generated, or have different textures) this is not.

I have some ideas how to fix this, but would need involvement of the author:

  • Implement the ability for geometry-components to accept arrays of parameters, which would then create arrays of three-geometries
  • Implement MergeBufferGeometry which would convert multiple geometries to a single one (this way you can support 1000s of objects). It would still need a way to avoid creating thousands of components though.
  • implement a way to disable reactivity (assuming its all the watchers that are the problem)