Hi there, I’ve just been experimenting by importing GLB files into my THREEJS Scene, there are around 100k unique objects/Meshes in the GLB file, I’ve added it to the scene and noticed that even when the object.visible = false, there is still significant drop in the FPS of the overall Scene, is this normal and to be expected? I assumed because the Object was Loaded & Not visible on the scene, it shouldn’t be impacted by performance.
The overhead could be related to world matrix computations. It could also be related to limited hardware resources. Without a demo that demonstrates the issue it’s hard to tell.
Remove them from the scene to see a significant gain!
I would, but I kind of need the data later on after a user selection, is there anyway to remove from scene but re-use the data when needed? Loading of the GLB file is quite large, so wasn’t sure best practices.
As long as you have a global reference to the object, it remains in memory and can be added again.
Think of it as creating a HTMLElement and adding it to DOM.
It can be removed and added as long as reference to document.createElement() is alive.
I see, that’s great to know, and a great way to put it. Thank you, I’ll try experimenting with this…I can just scene.remove(object) and then scene.add(globalMemoryofobject) when needed again?
It is your project and without having access to it, you are only one who knows the best approach.
If I were you, I’d divide it to smaller bits.
I have to log off now, will be back in few hours.
Thank you, appreciate your help on this!
My second option was to take the GLB model (My models are actually 2D land maps) and export as a Vector Pathed SVG and then Import with the SVGLoader… the SVG sizes are maybe 1/10th of the sizes of the GLB models.
However do you think that would even give an overall performance benefit…Considering there is the same amount of objects to be added to the scene?
100,000+ unique THREE.Mesh objects in the scene will be a performance problem, independent of how they’re downloaded over the network. Unless SVGLoader somehow results in far fewer objects, I think it’ll be the same situation, and you’d need to instead look for ways of merging the content into a smaller number of objects sharing the same materials.
Hi @donmccurdy thanks for your reply. Big fan of gtlf-transform, unfortunately I wish I could reduce them however each land item is clickable, also with a unique shape. I thought the SVGLoader would at least give the downloading of assets a really quick load time.
An application that deals with hundreds of thousands objects will need to do one of two things:
- avoid drawing more than ~1% of those objects at a time (“thinning” or “tiling”)
- combine objects (“batching”), and find ways to implement selection compatible with that
Clicking part of a Mesh isn’t as simple to implement as clicking a whole Mesh, but it’s possible if you separate what you’re drawing from what you’re raycasting into, e.g. with three-mesh-bvh. The selected “parts” of a mesh can be highlighted with custom shaders, etc. I believe this is what you’ll find behind something like IFC.js.
I think it would be best to start a new thread with corresponding subject implementing this wise man suggestion
Thank you for your detailed response, I’ll look into one of those 2 options as a possibility, I believe option 1 would be the most suitable considering a lot of land mass does not need to be shown on the screen at one time.
Thanks again for taking the time to reply to my questions.
Yes no problem, i think the solutions you guys have given me have been enough of a help to move forward, already having positive results. Thanks again!