Importing models with huge sizes

I have some questions about importing models.
I heard its no problem to import files until file size is bigger then 50MB.
I imported a file size for test procedure with 170MB. I could import it (after a long time), but the whole program was shaky and when using OrbitControls the program overall was very lagy and shaky, so it just could’t handle this file size.
Lets say i have a huge file with f.e. 1Gb file size and f.e. with .stl format.

  1. Is it possible, if the file contains many objects (f.e. it would be a house with many levels) that instead of importing the 1GB file, i could import 20x 50MB files. Would the program still be shaky or can the program just handle many smaller files better… Would the program still be shaky? Is there a max file size for all objects together or just the max file size for single files?
  2. is there a way to import a huge file somehow, but just render parts of the object? For example if i am on level 1 in my building i just render level 1 and all other levels will not be rendered. When going to level 2, level 1 will not be rendered anymore, but level 2 gets rendered.
1 Like

It’s always hard to evaluate performance issue without analyzing the real app. But in general, if the performance is bad because of the geometry’s complexity, you won’t see any difference if you split up the asset into multiple ones. The performance could be actually worse if you introduce more draw calls with this approach. That happens because a single large object can be rendered with one draw call. But not multiple ones (unless you merge these objects manually).

Parsing of STL files allocates more memory than parsing glTF. So I suggest you convert your STL files to glTF and see how it improves file size and parsing time. You can further reduce the file size by using Draco compression. But keep in mind that these actions will only improve the loading/parsing overhead, not the actual rendering performance.

Of course it’s possible to do this but three.js can’t do it automatically for you. E.g. you have to decide when certain objects are rendered and when not. Advanced culling algorithms like occlusion or portal culling are not available in three.js.

Thanks for your help!
Is there a possibility to convert stl files to gltf files in three.js?

You can import STL files into the editor and then export as glTF.

When i load a stl-file with 110MB in three.js editor, the three.js editor is able to handle the file! Does three.js editor covert the file internally to gltf? Why can the editor handle files with bigger sizes, do you know that? Do they compress the file (zip or something)? In my application 110MB is that shaky that the program is almost not manageable.

Btw. I convered the stl-file to gltf, which makes it a 210MB file, but its actually better to handle in three.js

The editor just loads the STL file without further pre-processing. The file is definitely not converted to glTF. Unfortunately, I can’t tell you why your app has performance issues without seeing the code. You might want to demonstrate your problems with a live example.

1 Like