1

I'm trying to write some code to manipulate .STL ASCII files, and I'm trying to fully understand the file format. From what I've seen, the content of the "facet normal" line of each triangle has no effect on the triangle drawn. It also does not have any effect on which side of the triangle is considered the "outside", which is done by reversing the order of the vertices.

This triangle

facet normal 1 1 1
   outer loop
      vertex -1 1 1
      vertex 1 -1 1
      vertex 1 1 -1
   endloop
endfacet

is identical to this triangle

facet normal -1 -1 -1
   outer loop
      vertex -1 1 1
      vertex 1 -1 1
      vertex 1 1 -1
   endloop
endfacet

which is also identical to this triangle.

facet normal 1 0 0
   outer loop
      vertex -1 1 1
      vertex 1 -1 1
      vertex 1 1 -1
   endloop
endfacet

Given that having an explicit normal vector is redundant information mathematically, and that it's not even used in the drawing of the solid anyway, why is it in the file format? And if it's used for something, what is it for?

EDIT: I should add that I'm opening these files in Autodesk Meshmixer.

Braden
  • 21
  • 4
  • More complete answers available at 49265220 , https://stackoverflow.com/questions/49265220/why-is-a-normal-vector-necessary-for-stl-files/52500597#52500597 – Carl Witthoft Sep 25 '18 at 14:29

1 Answers1

1

You did tested this how? If normal is not used by program you used to test then that does not mean the normals are not used at all in any other program there is. There are several reasons to include normal:

  1. smooth graphic shading (rendering)

    without normals you can not have smooth shading and smooth surfaces would look choppy unless very high triangle count is used...

    choppy Earth

    However to achieve really smooth shading we need per vertex normals and IIRC STL has only per face normals so the smoothing can be used only for artifact surface triangles.

  2. Declare tool access side and angle (printing)

    The STL is meant for 3D printing and depending on the technology used the normal could have special meaning like determining the access angle of tool to the surface or even can be used to tweak the layer structure or what ever. All of this this depend on how the control software of the printer interprets or use it.

Spektre
  • 49,595
  • 11
  • 110
  • 380
  • Why is explicitly stating the normal of a triangle necessary in either of these two things? The information of the direction of the normal vector is already present in the three points which define the triangle. I'm just wondering why the information is also provided explicitly. – Braden Dec 04 '17 at 03:20
  • @Braden because the normal used is not always the same as the geometric vector perpendicular to the triangle surface. – Spektre Dec 04 '17 at 07:26
  • Oh that's interesting. What would be the definition of the "normal" vectors in an STL file in this case? Is it just any vector which carries the most relevant information for its triangle, for whatever reason might be needed for the given file? – Braden Dec 05 '17 at 00:21
  • @Braden as the answer says ... That depends on the used SW/HW. You stated you use Autodesk mesh mixer. I do not know it but the name suggest it is just some utility tool handling more file-formats which are usually supporting just basics .... and have nothing to do with STL printing functionality nor STL specifics. – Spektre Dec 05 '17 at 08:12