Maybe I’m missing something from skimming this thread. Why are axes being swapped when switching handness? That seems a bit arbitrary.
As far as I can tell, STL doesn’t specify any conventions. We can maybe add a flag for common ways to handle the conventions, but using scene.useRightHandedSystem seems a bit odd to me.
Note: OBJ specifies that the XYZ are right-handed but it doesn’t mention which axis is up.
Yup, I knew we needed @bghgary knowledge on this one @AlbertoPa would you mind adding a flag to change it as we do in obj so that users can control it instead ?
@bghgary To clarify, my proposed patch reverts a change to the coordinates forced by babylon to enforce y as the upward direction, which introduces an inconsistency between the input file and the visualization. As you said the STL format does not impose an upward direction (it does define the right-hand rule needs to be used to define normals only), so it is unclear to me why a change is applied in the first place. Why not just acquire coordinates as they are (note: discussed previously in this thread, but no consensus found )? On the other hand, it would be a breaking change compared to the current behavior.
Since the format doesn’t specify, there isn’t really a right answer. It completely depends on the software writing it out. Whoever wrote the original reader is assuming one particular convention which may be right for some scenarios but not for others. A flag to change the conventions used seems the most reasonable IMO and will make it possible to change the conventions while maintaining backwards compatibility.
I’m fine with an additional flag. It was suggested to use “useOriginalCoordinates” in a previous comment. Would that work?
Also, do other loaders (and serializers) need to be updated, so that their behavior is consistent when the flag is used? I have no experience with Babylon serializers so far
Note: I have not implemented MeshLoadOptions, currentMeshLoadOptions, etc. because I am not sure if it is required. Let me know and I’ll look into it if needed.
I think it is fine but let s pit the default value to how it worked before to prevent breaking changes. You could open a PR for it this might be the simpest
Hi everyone,
very nice to see, that there finally is a flag to disable this flipping Y/Z values behavior.
However, i noticed that when I import a mesh like this: data_formteil_1.zip (44.1 KB)
And enable STLFileLoader.DO_NOT_ALTER_FILE_COORDINATES and use scene.useRightHandedSystem it looks like the faces are oriented the wrong way.
Do you understand what’s going wrong here?
Is this a problem with the STL file or BabylonJS/ the way how i use it?
Edit: I just checked the STL file with Rhino and the mesh normals are all oriented correctly. So there might by some error during the import? @AlbertoPa@sebavan