# How to Convert a Z Up Matrix to a Y Up Matrix?

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.

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.

• 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. – Alex Sep 29 '17 at 21:02
• Sorry i was confused the first one works perfectly, thanks! – Alex Sep 29 '17 at 21:06