Closed jordig100 closed 2 years ago
After having discussed, it seems that the spec intent was to be able to flip or mirror a surface defined by a mesh and still produce a printable surface.
Let's propose the following wording to clarify it:
As a consequence the test cases must be reversed as?
Two test cases i find interesting:
Positive Mesh: Box and Box Mirrored.zip (please rename, github does not allow .3mf here) A mesh with outwards pointing normals, it is referenced twice
det = 1
: "Box"det = -1
: "Box (mirrored)"Negative Mesh: NegativeBox and NegativeBox Mirrored.zip A mesh with inwards pointing normals, it is referenced twice
det = 1
: "negative Box"det = -1
: "negative Box (mirrored)"Could you all start reply in the format below?
Results Netfabb
Positive Mesh | Displayed? | Printed? | Reexport |
---|---|---|---|
Box | no errors, positive volume | yes | det(T) = 1 |
Box (mirrored) | back faces are rendered, negative volume | no | det(T) = -1 |
![]() |
![]() |
Negative Mesh | Displayed? | Printed? | Reexport |
---|---|---|---|
negative Box | back faces are rendered, undefined volume | no | det(T) = 1 |
negative Box (mirrored) | no display errors, undefined volume | no | det(T) = -1 |
![]() |
![]() |
Comments:
det < 0
.Results Magics
Positive Mesh | Displayed? | Printed? | Reexport |
---|---|---|---|
Box | no errors, positive volume | yes | det(T) = 1 |
Box (mirrored) | displayed in some dark way (as renderer doesn't expect transformations with negative determinant) | no | det(T) = -1 |
Negative Mesh | Displayed? | Printed? | Reexport |
---|---|---|---|
negative Box | back faces are rendered, undefined volume | no | det(T) = 1 |
negative Box (mirrored) | displayed in some dark way (as renderer doesn't expect transformations with negative determinant) | yes (although might depend on the slicer/BP used) | det(T) = -1 |
Comments: Very similar behavior as Netfabb.
det < 0
.Results Cura
Positive Mesh | Displayed? | Printed? | Reexport |
---|---|---|---|
Box | no errors, positive volume | yes | det(T) = 1 |
Box (mirrored) | no errors, positive volume | yes | det(T) = -1 |
Negative Mesh | Displayed? | Printed? | Reexport |
---|---|---|---|
negative Box | no errors, positive volume | no | det(T) = 1 |
negative Box (mirrored) | no errors, positive volume | no | det(T) = -1 |
Comments: The only thing different with the negative meshes is that the display of what an overhang is is no longer correct
We have investigated various FDM slicers we have access to.
PrusaResearch-Mirroring investigation.pdf
In a nutshell, Cura, ideaMaker, Microsoft Paint 3D and PrusaSlicer produce negative determinant transformation matrices if an object is mirrored at the user interface. In that case Microsoft Paint 3D and PrusaSlicer save the mesh as is with positive volume, while Cura and ideaMaker flip mesh normals thus they store a negative volume mesh.
It seems that the intent of the core spec is that the transform is applied to the shape defined by the mesh, or any other extension. Allowing mirroring in 3MF is a requirement from consumer segment, according to PrusaResearch.
Here you can have a new proposal:
Transforms are applied to the shapes defined by objects. When applying a transformation with a negative determinant, the resultant shape MUST NOT change the sign of its volume.
After applying all transforms to an object, the model SHOULD have positive volume and SHOULD be located in the positive octant of the coordinate space.
Consistent Triangle Orientation: Every pair of adjacent triangles within the mesh MUST have the same orientation of the face normal toward the exterior of the mesh, meaning that the order of declaration of the vertices on the shared edge MUST be in the opposite order. For example, if Triangle1 has vertices ABC and Triangle2 has vertices DEF and Triangle1 and Triangle2 share the AB/DE edge, then it MUST be the case that vertices A=E and vertices B=D (see figure 4-1 below). A triangle face normal (for triangle ABC, in that order) throughout this specification is defined as a unit vector in the direction of the vector cross product (B - A) x (C - A). For example, the triangles shown in figure 4-1 have normals pointing out of the page. If the applied transformation has a negative determinant, the vertex ordering of those triangles MUST be inverted in order to preserve the sign of the volume. If the applied transformation has a negative determinant, the vertex ordering of those triangles MUST be inverted in order to preserve the sign of the volume.
Outward-facing normals: All triangles MUST be oriented with normals that point away from the interior of the object. Meshes with negative volume will not be printed (or will become voids), in accordance with the Positive fill rule defined in the next section. In combination with the preceding two rules, a mesh is therefore a continuous surface without holes, gaps, open edges, or non-orientable surfaces (e.g. Klein bottle).
As a consequence the test cases must be reversed as:
According to the current implementations, the meaning of files including these "features" of the core-spec is unclear:
As of now, and according to the investigations above, producers of 3MF files that use features cannot expect deterministic behavior of the consuming applications.
Therefore, I propose:
Producers of 3MF files MUST create transforms with positive determinant only. This ensures that geometric properties of an object (in particular the meaning of the inside of an object) can be determined in the coordinate frame of an object. 3MF files that violate this condition can not be interpreted unambiguously by consumers. Consumers SHOULD reject such files.
After applying all transforms to an object, the model SHOULD have positive volume and SHOULD be located in the positive octant of the coordinate space.
Consistent Triangle Orientation: Every pair of adjacent triangles within the mesh MUST have the same orientation of the face normal toward the exterior of the mesh, meaning that the order of declaration of the vertices on the shared edge MUST be in the opposite order. For example, if Triangle1 has vertices ABC and Triangle2 has vertices DEF and Triangle1 and Triangle2 share the AB/DE edge, then it MUST be the case that vertices A=E and vertices B=D (see figure 4-1 below). A triangle face normal (for triangle ABC, in that order) throughout this specification is defined as a unit vector in the direction of the vector cross product (B - A) x (C - A). For example, the triangles shown in figure 4-1 have normals pointing out of the page. If the applied transformation has a negative determinant, the vertex ordering of those triangles MUST be inverted in order to preserve the sign of the volume.
Outward-facing normals: All triangles MUST be oriented with normals that point away from the interior of the object. Meshes with negative volume will not be printed (or will become voids), in accordance with the Positive fill rule defined in the next section. In combination with the preceding two rules, a mesh is therefore a continuous surface without holes, gaps, open edges, or non-orientable surfaces (e.g. Klein bottle).
As a consequence the test cases should behave as follows:
P_???_0416-02 Negative Determinant. A positive volume mesh with a negative determinant transform. ???
N_???_321-01 Negative Volume Mesh. A negative determinant and a mesh with negative volume. ???
To add a new negative test case for Negative volume mesh and a Positive determinant: ???
Update from 2021/06/24:
@jordig100 plans to write this up.
What happens if you want to reuse a model: one instance as it is and a second instance mirrored? It seems that the intent was that the mesh defines the shape and the mirror just flips the shape, and both are printable.
However current spec is kind of contradictory and some implementations and test suite interpret that the mirror flips the mesh and inverts the volume, cleating a negative volume.
Current spec defines:
3.3. 3D Matrices
After applying all transforms to an object, the model SHOULD have positive volume and SHOULD be located in the positive octant of the coordinate space.
4.1. Meshes
Consistent Triangle Orientation: Every pair of adjacent triangles within the mesh MUST have the same orientation of the face normal toward the exterior of the mesh, meaning that the order of declaration of the vertices on the shared edge MUST be in the opposite order. For example, if Triangle1 has vertices ABC and Triangle2 has vertices DEF and Triangle1 and Triangle2 share the AB/DE edge, then it MUST be the case that vertices A=E and vertices B=D (see figure 4-1 below). A triangle face normal (for triangle ABC, in that order) throughout this specification is defined as a unit vector in the direction of the vector cross product (B - A) x (C - A). For example, the triangles shown in figure 4-1 have normals pointing out of the page. If the applied transformation has a negative determinant, the vertex ordering of those triangles MUST be inverted in order to preserve the sign of the volume.
Outward-facing normals: All triangles MUST be oriented with normals that point away from the interior of the object. Meshes with negative volume will not be printed (or will become voids), in accordance with the Positive fill rule defined in the next section. In combination with the preceding two rules, a mesh is therefore a continuous surface without holes, gaps, open edges, or non-orientable surfaces (e.g. Klein bottle).
The Outward-facing normals seems to apply to the mesh itself, before any transform is applied.
See tests: