I'm a software developer, I have a external application that generates .obj files. After importing the generated model I see, only when the view is set to "Render" or to "Material", or when I disable auto smooth, that a lot of normal directions are flipped.
It's strange because they are perfect when auto-smooth is enabled. The model contain some hard edges, to avoid normal interpolation/smoothing in those I generate multiple vertices when they are in a hard-edge: each vertex will have the same position, but different normals.
I think that the normals are fine because I see their directions on my app and they are fine there, but Blender flips some of them. Why? Is the order of each vertex in each face important? Should I avoid having more than one vertex defined with the same position (having more vertex normals than vertex positions)?
EDIT: I changed my program to avoid repeating vertex positions, now it contains more vertex normals than vertex positions.
EDIT 2: Changed my program to delete duplicated normals, problem persists.
EDIT 3: Changed my program to order the vertices in each face. It seams that Blender overrides the normals written in the .obj file... This solves the problem for the cube model below, but it doesn't solve it when the model is smooth but have some hard edges... Blender keeps changing the normals, overriding the imported ones >:
.obj file that I imported on Blender. Seems good to me.
o Robot
v 0.100000 -0.100000 -0.100000
v 0.100000 0.100000 -0.100000
v 0.100000 0.100000 0.100000
v 0.100000 -0.100000 0.100000
v -0.100000 0.100000 -0.100000
v -0.100000 -0.100000 0.100000
v -0.100000 0.100000 0.100000
v -0.100000 -0.100000 -0.100000
vn 1.000000 0.000000 0.000000
vn 0.000000 1.000000 0.000000
vn 0.000000 0.000000 1.000000
vn 0.000000 0.000000 -1.000000
vn -1.000000 0.000000 0.000000
vn 0.000000 -1.000000 0.000000
f 1//1 2//1 3//1
f 4//1 1//1 3//1
f 5//2 2//2 3//2
f 6//3 3//3 7//3
f 4//3 3//3 6//3
f 8//4 1//4 5//4
f 7//2 3//2 5//2
f 2//4 5//4 1//4
f 8//5 5//5 7//5
f 6//5 8//5 7//5
f 6//6 8//6 4//6
f 8//6 1//6 4//6