How to have a high max count for InstancedMesh without lag when only a small amount of instances should be drawn ? #416
mat100payette
started this conversation in
General
Replies: 1 comment 6 replies
-
i guess you would need to know how fast the host system is. threejs doesnt offer anything like that, perhaps you find a lib on npm that can give you something, then you could make the number adaptive. i've also always wanted something like that, to downgrade the experience with an acceptable fps. if you ever find something please let me know. |
Beta Was this translation helpful? Give feedback.
6 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I have the following code which takes in a count variable in the props of the component. That count is used to fill the colors for the geometry.
Now the problem is that no matter what I do in the main
useFrame
loop, even if I don't use many instances, if theMAX_INSTANCES
constant is high (10k is little lag, 100k is very noticeable, 1M is terrible) then things become laggy. I don't quite expect to be able to draw 1M instances without lag without doing proper threejs optimization and stuff, but it'd be great to at least have a way to allow for a high maximum of instances in the mesh (or no limit even), and have the lag be proportionate to the amount of instances drawn instead. Is that possible ?Beta Was this translation helpful? Give feedback.
All reactions