0
$\begingroup$

Using Open 3D Model Viewer, I have converted an OBJ file to an STL file. In the source file, the Vertex Normals are specified and in the destination, the face normal of the triangles are present which are different than the normals one would get by (a-b) x (a-c), where a, b, c are the vertex coordinates and x is the cross product. How one would compute the face normal in the presence of vertex normals?

Also, I am given to understand that STL format has a positive octant rule which requires all vertex coordinates to be positive. When the OBJ file has negative vertex coordinates, what should be done in the conversion process?

$\endgroup$
1
$\begingroup$

I'm not familiar with the exact nuances of the STL format, but here are some answers on general computer graphics principles:

In the source file, the Vertex Normals are specified and in the destination, the face normal of the triangles are present which are different than the normals one would get by (a-b) x (a-c), where a, b, c are the vertex coordinates and x is the cross product. How one would compute the face normal in the presence of vertex normals?

There is no general method to convert vertex normals to face normals. Vertex normals (that are not all equal) can express the normals of a curved surface, which face normals cannot. Thus, converting to a format with only a normal vector per face, rather than per triangle vertex, is a lossy process — some information was discarded. The converter must make a compromise.

That said, from some quick research, it seems that the intent of the STL file format is that the normal is the normal perpendicular to the triangle (that can be computed as you specified), not a chosen vector, even though that makes it redundant. So perhaps your converter is wrong (though I can't say much as you didn't say how it was different).

Also, I am given to understand that STL format has a positive octant rule which requires all vertex coordinates to be positive. When the OBJ file has negative vertex coordinates, what should be done in the conversion process?

The only option is to choose some offset by which to translate all of the vertices so that they are positive. This also loses some information — what the origin of the original model was. That's easier to recover if needed, though, since it's just a 3D vector that you could translate back by when loading the model.

| improve this answer | |
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.