Incorrect coordinates when creating meshes from txt files

Hello! I have created several meshes from txt files and the coordinates do not match up with the original mesh (from which the txt files were created). We originally created this 3d object in Freesurfer and are viewing it in Blender and it looks as follows:

We then saved the faces and vertices as txt files from Blender and uploaded them to Babylon and created new meshes. It originally looked like this when we first imported it:
We then found that multiplying all of the vertices by -1 fixed this issue and we are able to see the brain in what looks to be the same as in Blender:

The problem, now, is that the coordinate system seems to be different than that of Blender. When I click on a certain spot in Babylon the coordinates seem to be in the order of (X,-Z,Y) when compared the coordinates of Blender. I would assume this has something to do with the multiplying by -1/inverting the mesh to make it appear normal, but would love to understand why 1) it was necessary to do so in the first place and 2) why that changed the coordinate system.

Here you can see a click a point in Blender and the coordinate is (23.91, 86.20, -18.79):

And then here in Babylon the coordinate of (roughly) the same location is (21.38, 11.58, 88.24):

Obviously the numbers do not match perfectly because I could not click the exact same location but this pattern holds for different part of the meshes.

Any help understanding this would be greatly appreciated, thanks so much!

Seems that mesh origin and world origin don’t correspond. -1 appears because of different coordinates systems (righthand and lefthand).
Also, try to export your model as GLB and see what will happen.

Thanks so much for your quick reply! So turns out we had rotated the meshes in a place we didn’t mean to, so the coordinates are not as wrong as previously thought. What we have now, however, is (-x,-y,-z) for a coordinate that is (x,y,z) in Blender. I am still a little confused about your comment though. Is the Babylon coordinate system different than in Blender (or is this possible) or could there be some other reason that this is so? Thanks for your help.

By default, Babylon.js uses a left-handed coordinate system.
I don’t know from which coordinate system you get in your mesh data.
If I remember correctly, Blender uses right-handed coordinate system.

1 Like