5

STL is the most popular 3d model file format for 3d printing. It records triangular surfaces that makes up a 3d shape.

I read the specification the STL file format. It is a rather simple format. Each triangle is represented by 12 float point number. The first 3 define the normal vector, and the next 9 define three vertices. But here's one question. Three vertices are sufficient to define a triangle. The normal vector can be computed by taking the cross product of two vectors (each pointing from a vertex to another).

I know that a normal vector can be useful in rendering, and by including a normal vector, the program doesn't have to compute the normal vectors every time it loads the same model. But I wonder what would happen if the creation software include wrong normal vectors on purpose? Would it produce wrong results in the rendering software?

On the other hand, 3 vertices says everything about a triangle. Include normal vectors will allow logical conflicts in the information and increase the size of file by 33%. Normal vectors can be computed by the rendering software under reasonable amount of time if necessary. So why should the format include it? The format was created in 1987 for stereolithographic 3D printing. Was computing normal vectors to costly to computers back then?

I read in a thread that Autodesk Meshmixer would disregard the normal vector and graph triangles according to the vertices. Providing wrong normal vector doesn't seem to change the result. Why do Stereolithography (.STL) files require each triangle to have a normal vector?

Jason Liu
  • 109
  • 1
  • 4
  • 1
    I don't have an answer. [Wikipedia](https://en.wikipedia.org/wiki/STL_(file_format)#The_facet_normal) says a few words about it. It might have to do with differentiating inside from outside for open surfaces. – Nico Schertler Mar 14 '18 at 07:14
  • yep the STL does not have winding rule specification which means you do not know which way the computed normal should face ... hence you do not know from which side you should position the printing head. Of coarse it can be computed but that is relatively expensive operation especially for high triangle count concave meshes. – Spektre Mar 14 '18 at 07:49
  • Actually according to [all3dp](https://all3dp.com/what-is-stl-file-format-extension-3d-printing/#pointfive) the winding is specified and required to be counter-clockwise facing inward. Normals should point outward. – codehearted Jan 19 '19 at 04:15
  • I assume Spektre's comment is the answer to the question. Although the winding rule is commonly used I can imagine that it was not regarded in the specification. – anhoppe Sep 09 '22 at 14:14

1 Answers1

1

At least when using Cura to slice a model, the direction of the surface normal can make a difference. I have regularly run into STL files that look just find when rendered as solid objects in any viewer, but because some faces have the wrong direction of the surface normal, the slicer "thinks" that a region (typically concave) which should be empty is part of the interior, and the slicer creates a "top layer" covering up the details of the concave region. (And this was with an STL exported from a Meshmixer file that was imported from some SketchUp source).

FWIW, Meshmixer has a FlipSurfaceNormals tool to help deal with this.

Carl Witthoft
  • 20,573
  • 9
  • 43
  • 73