3
$\begingroup$

Why does the blender show that the normal directions are different?

enter image description here

B.stl

solid B
        facet normal -1 0 0
                outer loop
                        vertex -5 5 -5
                        vertex -5 5 5
                        vertex -5 0 0
                endloop
        endfacet
        facet normal -1 0 0
                outer loop
                        vertex -5 5 -5
                        vertex -5 -5 -5
                        vertex -5 0 0
                endloop
        endfacet
endsolid
$\endgroup$
1
  • $\begingroup$ Thanks for your edit .. got it, now, see edit in my answer. $\endgroup$
    – Robin Betts
    Commented Feb 5, 2020 at 12:47

1 Answer 1

4
$\begingroup$

enter image description here

It's because the vertices of the faces are listed in different orders.

The first face (red) is listed clockwise, and the second face is listed anti /counterclockwise, when viewed from this side.

The normal of a triangle can be calculated from the cross-product of two of its edges. The function is not commutative, so the order in which the edges are taken matters.

In Blender, and most other 3D applications, the vertices of a face are ordered in an anticlockwise direction, when the face is viewed with its normal towards you.

Whatever the 'Facet Normal' variable is doing.. (is it actually a scalar? 1 or -1?) it's doing the same to both facets, so does not alter the inconsistency in vertex order.

Edit: On further reading, it seems that facet_normal is intended to be a redundant, pre-calculated normal of the triangle, measured in the same space as the vertex coordinates. If not used, it's probably best set to (0,0,0).

In the example given, it's correct for the blue face but inconsistent, (actually inverted) for the red face, as defined by the order of its vertices.

$\endgroup$
4
  • 1
    $\begingroup$ There is a use_facet_normal option available on import. However it spits the dummy for me with Mesh' object has no attribute 'show_edge_sharp' Notice that rather than anticlockwise I find it is more commonly notated counterclockwise. Wonder if it's UK vs US english. I'm in Oz and grew up using anti. $\endgroup$
    – batFINGER
    Commented Feb 5, 2020 at 2:20
  • $\begingroup$ @batFINGER Cheers! I've already given way to 'color' and 'normalize'.. oh, well ... is facet_normal a vector? I wonder what space that would be in? $\endgroup$
    – Robin Betts
    Commented Feb 5, 2020 at 9:41
  • $\begingroup$ @batFINGER .. np, got it. $\endgroup$
    – Robin Betts
    Commented Feb 5, 2020 at 12:45
  • 1
    $\begingroup$ Was hoping it set the normals as in file. Editing code to remove error and setting the use facet normal to true, doesn't change the outcome in this case anywhow. RE the error blender.stackexchange.com/questions/126707/… $\endgroup$
    – batFINGER
    Commented Feb 5, 2020 at 12:47

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .