0
votes

I have this stl model that has >3 million vertices and have to render it on screen. Right now, loading the model using a Threejs STL loader crashes the browser. Based on some research, I'm considering doing some of the following:

  1. Stream the STL file to the client and have the STL loader load the model in 1mb chunks

  2. Every time a chunk gets loaded, I can create a buffer geometry and construct a mesh from it. I can do this for every chunk and add all the meshes to the scene. Thus the scene will have multiple meshes in it, but look like it's the original model.

I have a pretty good idea of how to do step 2, but is the first part possible? Can a three.js STL loader load an STL in chunks (assuming it's being delivered to the client in chunks) as I've described?

1
I would split that model in multiple models in my favourite editor and loach each part separately. Abd merge geometries as individual models are loaded.Console-buche
Using glTF causes much less parsing overhead. I would start with this option.Mugen87
Do you know where the crash is occurring? Is it actually a problem with STLLoader, or is it a problem with how the file defines the shapes? Without knowing more about your data, I think your option 2 (or what @Hesha suggested) are the correct approaches.TheJim01

1 Answers

1
votes

The Three.js STL loader won't do that for you (it will always load the whole file and then parse).

You'd have to load and parse the file in chunks yourself. It is a pretty straightforward file format (https://en.wikipedia.org/wiki/STL_(file_format) ), you'd have to handle the case where a STL triangle structure spans chunks, however.

Another option, if it makes sense for your application, is to read and preprocess the file into a format that can be read in chunks in the browser.