I have a 3D mesh in an obj file that was the output of a 3D face-reconstruction algorithm. Problem is that the algorithm mirrors the face along the 2nd axis, i.e. every vertex v x y z
is in "reality" v -x y z
.
I tried the obvious thing to invert all the x's, it works, but now the mesh has inverted face orientation. I was able to fix that by applying Filters -> Normals, Curvatures and Orientation -> Invert Faces Orientation
in MeshLab.
Problem is I can't understand what that option does or why my original fix didn't work, Can you explain? Also, can you explain what do the normals in the wavefront.obj format represent geometrically?
If you invert the sign of coordinates X in the lines starting with "v", you need to change also the sign of the X in the "vn" lines, which represent the Normal-by-vertex of the mesh. You can do it very easily with the meshlab filter "Per vertex Normal Function" and the expression:
nx = -nx
ny = ny
nz = nz
Anyway, that "the algorithm mirrors the face along the 2nd axis" sounds strange. Most probably is not changing the sign of X coordinates, but rotating your mesh 90 degree due that your program is configured as "Z Axis is Up" instead of "Y Axis is up". This rotation will change the sign of one coordinate and also will interchange the values of your coordinates. I suggest to revise this and understand if your algorithm is "X mirroring" or "reorientating" the input mesh.