STLLoader has problem loading some mesh files

I tried to display a mesh using three.js
Preview of mesh

This file can be display on netfabb and meshlab (one of them gave a incorrect STL file warning), but if I use STLLoader to load it, the geometry.faces and geometry.vertices of the loaded content are both empty.

I’m pretty sure this file is in binary format as I’ve loaded it using a C++ mesh processing library. This file is sized 458876 bytes, but if we use the metadata at the beginning of the file to estimate the size, we get 458784 bytes.

Looks like the software generating this file added something at the end, causing it to grows larger than expected.

The isBinary() function in STLLoader.js only checks if the actual file size is equal to the number calculated using the metadata, so this file is recognized as ASCII format because of the mismatch of sizes.

I think there’s some other way to check if STL file is in binary format?

Author: Fantashit

1 thought on “STLLoader has problem loading some mesh files

Comments are closed.