0
\$\begingroup\$

My 3D program exports my vertex data and instancing matrixes in Z+ up format. I want to store them in my own data format as Y+ up. If given a Matrix4 describing a position with Z+ being up. How can I convert that to a Y+ up Matrix4?

I know you can just rotate the object but I don't want to rotate the object.

\$\endgroup\$
1
\$\begingroup\$

Anything you'd do would effectively be a rotation.

That's the matrix to apply to your other matrix:

[1 0 0 0]
[0 0 -1 0]
[0 1 0 0]
[0 0 0 1]

Alternatively:

[1 0 0 0]
[0 0 1 0]
[0 1 0 0]
[0 0 0 1]

Depending if you also need to convert a rhs/lhs (right-hand-system, left-hand-system) which I cannot infer from the information available. Both are a possibility.

If your mesh ends up all back-faces use the other matrix. That's because the 3D software package use a different system.

\$\endgroup\$
  • \$\begingroup\$ Stephane Hockenhull I am confused. The first one puts my model in the correct position but the faces are backwards. The 2nd one has correct faces but the model is mirrored across the X axis. My program uses the right hand system. \$\endgroup\$ – Alex Sep 29 '17 at 21:02
  • \$\begingroup\$ Sorry i was confused the first one works perfectly, thanks! \$\endgroup\$ – Alex Sep 29 '17 at 21:06

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.