You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a question about the vertex and normal conversion happening in MeshImporter.cs: the conversion that happens negates the X coordinate and maintains the Y and Z coordinates. Why is this the case? Perhaps I'm misunderstanding, but in Unity +X is right, +Y is up, and +Z is farther away. In Assimp, +X is also right, +Y is up, and +Z is closer by, into the camera, doesn't this mean only the Z coordinate should be inverted?
Testing some more with different models, some models have weirdly off Z values (meshes look fine, but some parts of the mesh are positioned farther away or closer by than they should be), whilst the same models imported in Blender look fine. I think this may be due to MeshImporter#L229:
As Assimp's coordinate system has an inverted Z axis compared to Unity, shouldn't this translation also be inverted? Changing this to -aTranslation.Z fixes the model for me.
I also tested the vertex and normal conversions from the OP with my large model, and this indeed confirms that these assumptions appear to be incorrect; if I change it back to the original code from this repository, the meshes are in all the wrong places. Only inverting the Z coordinates fixes it. For smaller models, this didn't seem to matter, only that they were sometimes appeared to be rotated incorrectly.
My rotation on the X axis is also off compared to Blender (it is inverted). I may be wrong and am not sure my math is correct here, but shouldn't (only) the X coordinate be inverted, because positive rotation goes clockwise in the direction of the other two orthogonal axes, which means that, when the Z axis is inverted in Assimp, only rotations over the X axis become opposite?
EDIT2: I just realized all these conversions and inversions can be skipped entirely by just passing PostProcessSteps.MakeLeftHanded to Assimp. This fixes all the above issues (which seems to confirm this is currently bugged), as well as additional issues I didn't even know I had 😄.
NoTuxNoBux
changed the title
Possibly incorrect vertex and normal conversion
Wrong (?) assumptions about Assimp coordinate system
Jun 18, 2021
I have a question about the vertex and normal conversion happening in
MeshImporter.cs
: the conversion that happens negates the X coordinate and maintains the Y and Z coordinates. Why is this the case? Perhaps I'm misunderstanding, but in Unity +X is right, +Y is up, and +Z is farther away. In Assimp, +X is also right, +Y is up, and +Z is closer by, into the camera, doesn't this mean only the Z coordinate should be inverted?The lines in question are MeshImporter.cs#L144 and MeshImporter.cs#L153.
The text was updated successfully, but these errors were encountered: