I am designing a tool that can read an obj file with duplicate meshes in, and export the transformation, scaling and rotation of each duplicate relative to the original model. I can establish the transform from the average of all the vertexes, and I think I can get scale by comparing the maximum and minimum x,y and z values, but I'm completely stumped on rotation. Does anyone have any advice re this?

  • \$\begingroup\$ Can you say anything about the ordering of the vertices / faces of the various copies, or will we have to treat the input as effectively randomly ordered point clouds? Point cloud alignment isn't a problem we frequently need to solve in games, but you can find many scholarly articles about techniques to solve it. \$\endgroup\$ – DMGregory Mar 14 at 13:29
  • \$\begingroup\$ They'd certainly be in triangles, if that's what you mean. I think the obj exporter in 3ds max will order vertexes in world position within that scene. I'll certainly check that link, the only solution for rotation that has jumped out at me is comparing the rotation of the vector formed by the furthest away points in XZ plane for Y rotation, XY for Z etc. Will comment if I get anywhere with those articles \$\endgroup\$ – Will Hain Mar 14 at 16:00

For identical meshes, this should be relatively easy, as opposed to the harder case of pointclouds with unknown correspondence.

In your case, you can just pick an arbitrary triangle, let's say the first one in the (identical) mesh.

And then find the transformation that transforms triangle T0 into triangle T1.

Additionally, there is also a method for mapping point clouds that are noisy, yet have known correspondence.

  • \$\begingroup\$ Do you know if there is a simple way of selecting the same triangle in the mesh, given than the triangle may have different co-ordinates due to said rotation and transformation, and they may be in different orders? I haven't investigated this but I'm slightly worried 3ds max may export each meshe's triangles in different orders rather that remembering the first \$\endgroup\$ – Will Hain Mar 15 at 21:25

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.