Skip to content
Saving Space: STL vs OBJ
Some equivalent model files are more equal than others.
With most medical image postprocessing applications now emitting geometry for 3D print, there are subtleties in the formats that can help inform your choice. An important one is size.
STL has been the least common denominator file format for 3D printing for a long time. It’s a very simple file, using ASCII text and clear text keywords to indicate the nature of data. Without the ability to print in color, early STL architects did not need to add support for color – it’s simply a list of vertices, normals and triangle edges. The most basic form of the Alias Wavefront OBJ format is very similar, but its choice of single letter keywords saves some space. Interestingly, the way in which the applications specify the values can also have a huge impact on the final file size. This effect is magnified by the number of triangles, of course. Here are a couple of examples from Terarecon and GE Healthcare AW that demonstrate these points.
Here’s a sample triangle from a COVID lung model emitted from Terarecon software as STL. The full model contains 573320 vertices and normal comprising 1,141,212 triangular faces. Uncompressed this file is about 264358 kilobytes in storage.
Here is the exact same model after conversion (using MeshLab) to an OBJ format. Both are ASCII, rather than the more efficient binary, but that’s what most software emits. The OBJ format is only 90,658KB though. Significantly smaller for the same content. But why?
Each file must store three vertices per triangle and both store at least one normal (the STL uses face normal, the OBJ per vertex normal). The STL from TR indicates the triangle by wrapping the three vertices inside a facet definition which adds 29 characters per triangle, whereas the OBJ keeps a separate table of facet vertices and normals. The STL uses 13 bytes to encode a number and the OBJ uses 8. Taking just the content and ignoring whitespace, the STL needs about 107MB but the OBJ only 54MB. This is largely due to the difference of 5 bytes per number and the normal for each triangle in STL but just for each vertex in OBJ (there are less than half as many vertices as triangles). Both these formats use a significant about of whitespace (close to 50%) which increases readability but at a big cost in storage. For software applications running on limited memory devices and for people concerned with costs of bandwidth and storage, using OBJ instead of STL can be a big savings for the same model.
Share This Story, Choose Your Platform!
Page load link