Load multiple glb poor performance

Hi, i am developing an application which loads multiple glb files. First of all we have converted vrml files into glb files using three js vrwlloader and gltfexporter. Then i load the glb with gltfloader. The problem is that the performace is very poor, an scene with 1000 objects cannot be loaded because it consumes a lot of cpu and memory. We notice that the program is not using GPU completely. Why is that happening?
How can i improve performace?
Maybe the problem is the content of the wrmls. We have detected that a file has multiple geometries, so we are trying to mergebuffergeometries, but we loose triangles and color.
How can we mergebuffergeometries in the right way. Is there any other option to improve? Perhaps Draco compression but how does it works.

1 Like

The problem you’re seeing is that the scene has too many draw calls (one per object, if not more). This leads to the performance being CPU-bound, rather than GPU-bound.

Merging BufferGeometry instances is one good way to solve that, and probably the right place to start. How are you merging the geometries? Use BufferGeometryUtils.mergeBufferGeometries() to avoid losing triangles. If you’re losing colors, are you merging geometries that need to have different materials? Merged geometry must share a single material, so you’ll need to use vertex colors or texture atlases to preserve different colors on each geometry, or get a bit fancier with instancing.

Draco compression will not help in this case – it’s the number of objects that’s a problem, not the size, and in any case the objects have to be decompressed before rendering.

Some other performance suggestions in this thread: https://twitter.com/jackrugile/status/966440290885156864


Thank you for your answer.
this is how an object is structured

It has multiple meshes and every mesh has a buffer geometry.
The problem is when i merge buffer geometries i dont know how to add it to the object or to the mesh without loosing info.
Do you know how to do it?

1 Like


No, we don’t know how to do it. The type of “info” you want to preserve is not known to us. If you need hierarchy information and be able to identify/move elements in the scene - you probably don’t want to merge things. This is a question of trade-offs. If you have a lot of draw calls - you want to reduce that, but if you can’t merge your geometry - you have to live with poor performance.

There’s a lot more that you can do - i’m sure. But we do now know what trade-offs you might find acceptable.

Read the suggestions that @donmccurdy linked, consider your options - ask a specific question. Right now it’s turning into yet another “solve my problem for me” kind of question, which I’m sure you do not intend.