PDA

View Full Version : How to convert Max's transform matrix to Maya's trans. matrix?

 loocas05-28-2008, 09:49 AMHi there, EDIT: I figured it out, so, you don't have to answer here, but if you're interested to know, read my second post. Thanks anyways for your attention ;) I've been recently doing some conversion stuff between Max and Maya and I bumped into a problem I can't seem to solve. I need to translate (meaning convert) a Max's transform matrix into Maya's. The problem isn't in the matrix itself, I understand that and I'm able to communicate matrices between Max and Maya, the problem is the "Y UP" axis in Maya (or rather the "Z UP" axis in Max). What is the process I need to take in order to "rotate" the world coord sys along the positive X axis before exporting the matrix so that Maya understands it? Or is it something even more complex than this? First thing I tried was inverting the matrix from Max and loading it in Maya. It worked, the object was oriented the same in space, however, the X and Z axises were of opposite values (i.e.: not 90deg but -90deg). Is this the way? Or am I completely off the track here? Thanks a lot in advance, cheers, - loocas
SyncViewS
05-28-2008, 10:58 AM
Hi loocas,
I'm not completely sure about your needing, since I don't know Maya world coordinate system, but if you want to rotate a matrix in Max about its X axis you can use this:

matrix3 *= rotateXMatrix 90 -- Angle in degrees
I hope this helps

loocas
05-28-2008, 12:15 PM
Hi loocas,
I'm not completely sure about your needing, since I don't know Maya world coordinate system, but if you want to rotate a matrix in Max about its X axis you can use this:

matrix3 *= rotateXMatrix 90 -- Angle in degrees
I hope this helps

Nope, it's not the rotation of the matrix actually, I just found the solution, it's the xForm of the matrix.

More concretely it's this forumla (Max to Maya!):

(matrix3 [1,0,0] [0,0,1] [0,-1,0] [0,0,0]) * transform_matrix3 * inverse(matrix3 [1,0,0] [0,0,1] [0,-1,0] [0,0,0])

Anyways, thanks for your help, mate. :beer:

loocas
05-28-2008, 01:30 PM
One last note, I don't know whether that's an issue regarding cameras only, yet, but especially for the cameras, you'll need to preRotateX by negative 90 degrees the input matrix in Max before you convert it to Maya's matrix!

The reason is that Maya's camera has a different default rotation to Max's.

davestewart
05-28-2008, 04:16 PM
Thanks for posting Loocas, that's a nice tidy function :)

You're correct about the camera - it had me stumped for ages on a similar project. It's actually because the local axis is different to standard objects (it looks down its Z axis, not its X axis ... or is it the other way round!? One of them anyway)