Surface triangulation in Models

Hi.
I am using Slicer 4.11.20210226 in ubuntu 20.04
I have written a module that takes input a volume and markups and outputs a Model (surface). When I look at the Model it appeares smooth, but if I save it as an .stl file and reload it back into Slicer, it appeares triangulated. I have observed that in general, when I give triangulated surface as input to my other module, it gives better results than when the surface is not triangulated. So it is important for me to understand what the triangulation does. The surface also appears to be inflated once I save and reload it back again.

This is original surface (Model) in 3d view
before saving

This is after saving as .stl and relading back into Slicer as Model in 3d view
after saving and reloading

Why does triangulation happen when I just save and reload the file?
What difference does this make to the surface object?
Is this only a visible difference or is there some change in the data?

The faceted appearance due to using flat shading, because smooth Gouraud or Phong shading would requires surface normals. STL files cannot store surface normals, therefore when you save your mesh into this format then surface normals is lost.

You can either use a different file format (ply, vtk, obj, …) or recompute the normals using the Surface Toolbox module.

1 Like