Performance issues, memory overflow

The same model can be opened using Threejs, although it suffers from severe lag, using Babylon can cause page crashes

glTF Viewer (donmccurdy.com)
Babylon.js Sandbox - View glTF, glb, obj and babylon files (babylonjs.com)

https://github.com/dalidaliW/dalidaliW.github.io/blob/main/2.part06.rar

1 Like

I’m at 1 fps, but it’s very impressive that the viewer can render it, there 50 000 000 triangles in this file.

No clue how / why it crashes with BabylonJS, but have you noticed the 70 000 “unused object” alerts raised by the loader ? Could that be a reason for the file to be so huge ?

At least Threejs will not crash, while Babylonjs will. Although it only has 1fps, optimizing performance is based on the premise that it will not crash. If it crashes, optimization will have nowhere to start.

Do you plan to use this model in Sandbox or in more optimized environment?
Anyway, some model optimization (for example, Command-line quickstart | glTF Transform ) would improve FPS greatly.

1 Like

Do you know why it crashes? Is it out of memory or out of GPU memory (context lost possibly)?

This is a model that has already been compressed using Draco, with a native size of 1.3GB

It’s not that there’s not enough memory, my computer has 48GB of memory,Moreover, it does not crash in threejs

I would suggest first checking whether Three.js and Babylon.js are using the same WebGL context (WebGL1 or WebGL2).

Then, I think you can try to load this huge model without textures (maybe using some tricks, like return an empty texture in texture loader). This can help you check whether the memory issue is caused by the geometry or the textures. If it’s texture-related, you can try decreasing the texture size or using something like KTX2 for optimization.

You can also check the memory and graphics memory usage in your OS monitor before the crash. If your main memory is large enough, then the bottleneck is probably the graphics memory.

1 Like

Compression is something different than optimization :slight_smile:

Thank you, this tool is indeed useful

Any error on the console when it crashes?

Do you know how many materials and textures the model actually has? Can you confirm threejs actually loaded all of those?

I say this because perhaps they have some sort of cut off for loading too many materials or textures that helps it to not get into a sticky situation, its not unheard of , I think sketchfab has such limitations.

i hope someone is paying you in truck loads of cash to have to optimize such a model for realtime display.

2 Likes

More important here is Javascript memory heap size.
By the way, I cannot even inspect your model in GLTF-Transform CLI because of node.js heap limit aroung 4 Gb (by default), and this is not enough.
I believe you need to simplify your model in order to work with it further.

1 Like