How to load large stl files?

I have several stl files varying from 4-25 MB. Any files under 5MB load fine but anything larger seems to not load → behavior exists in BabylonJS sandbox too. I was able to compress a 25MB stl file to 5MB stl file in another tool and it loaded into BabylonJS (my AssetManager code and sandbox).

What is the best way to handle large stl files? AssetContainer/Manager (async)? progressive loading? Am I missing something special?

Also, are their recommended diagnostics to troubleshoot stl loading? Right now I’m using the AssetManager task onSuccess and onError but feel like I’m missing out on what/when things are happening.



That should work, at least if the file is < 512Mb (there’s a string limit in Chrome at 512Mb).

Do you have some errors in the console log? Can you share a file that does not work?


I’m glad to see that a Jedi Master is looking into this! I just sent you a private message with the files.

The files that do not load (with my code or sandbox) do not show any errors in console and do not show up as nodes in the inspector.

I’m hoping to learn more about stl import debugging and tools as I will be working with lots of stls of varying size and quality.

I’ll keep at it. I appreciate your mind share here.

Thank you.

Thanks for the files.

The ones that don’t work are wrongly formatted. They are in ASCII form (which is ok, both ASCII and binary formats exist for STL) and the first line is:


According to Wikipedia (STL (file format) - Wikipedia):

An ASCII STL file begins with the line:

solid name

where name is an optional string (though if name is omitted there must still be a space after solid).

In the two M and L files name is omitted but there’s no space after solid: if I add a space in both files they do work as expected.


I’m so glad it was a simple fix! Thank you.