The matrix in a 3D space has nothing to do with Neo’s hassle with sentinels, no, instead these are extremely useful and helpful vector arrays that make up a position, rotation and a scale of any object in your scene. Recently I’ve been re-inventing the wheel when I needed to write a system that’d allow me to instantly and without any user input transfer objects from Max to Maya and XSI. The reason for matrices in this case lies in the convenience of the whole matrix storing the object’s entire transformation information, which is, essentially, all that you need in order to accurately describe object’s exact position, rotation and scale in a 3D space.

The other reason is that Max is the only software (of these three) that has a differently aligned coordinate system. As opposed to XSI and Maya, Max’s world up direction is the Z axis, while Maya’s and XSI’s (default) world up direction is the Y axis. So, obviously, you cannot assume that when you move a box in Max 25 units along the X, Y and Z and rotate it 25 degrees along the, let’s say, Z axis, you’d get to the very same location and orientation when transferred to Maya or XSI. Not a chance!

So, how do you solve this problem? Well, thankfully, we have the transform matrix! As I said, every single entity in the 3D space (be it whatever, geometry objects, helpers, nulls, groups, vertices etc…) has its own transformation matrix so that it is explicitly given where the object is situated in the 3D space. There are many types of matrices, but the one we’re most interested in are the transform matrices. To cut the crap, a matrix is an array of values. This isn’t the most precise description of what a matrix is, but in a 3D package, the matrices are returned as a special type of an array. Let’s take a look at what you get when you ask Max and Maya for a special kind of a matrix an identity matrix. This is the matrix that describes the world’s coordinate system, it’s position, rotation and scale. This is the very basic matrix that every object, immediately after creation, transforms in it.

When you invoke a matrix3 1 in Max, it returns this value: (matrix3 [1,0,0] [0,1,0] [0,0,1] [0,0,0]) This is the identity matrix in Max. The very same identity matrix in Maya, as far as I know, cannot be created this way (but I’m almost 100% sure I just don’t know about the way yet), however, it can be queried from an object. If you create any object that’s perfectly aligned to the world and you ask for its matrix by invoking (in MEL) xform -q -m `ls -sl`; (assuming you’ve slected the object) you’ll get this: Result: 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 It may not seem so, but these two matrices are equal and, further more, are the very same, the only difference is that Maya returns a 16 double value while Max returns a matrix3 value. The other reason is that Maya’s matrix is a square matrix of order 4-by-4 (4×4), while Max’s matrix is of order 4-by-3 (4×3), the last column is omitted as it’s always the same and has no special meaning for the user. So, how come they’re “the same”? Well, if you look at it this way:

it should be clear that these identity matrices are exactly the same both in Max and Maya. There is one little problem, however. As I stated before, Maya’s and XSI’s default world’s up axis is the Y axis as opposed to Max’s Z axis. So, even though these identity matrices look exactly the same, they cannot be transferred between the packages as they are as that’d produce unwanted object transformation. What I needed for my project was a one-way conversion. I needed to transform Max’s transformation matrix into Maya’s transformation matrix. Thankfully it’s simpler than you might think. Generally, all you need to do is to transform your input transformation matrix into the Maya’s space, which can be done either from within Maya or directly within Max, or even outside in a separate program.

How exactly do you do that? And what is the Maya’s transformation matrix expressed inside Max? First things first. You have to know the Maya’s world transformation matrix relative to Max’s first in order to transform into that space. This can be easily generated in Max as all you have to do is to align a point helper (point helper because it can display it’s local axis tripod), manually, in Max so that it reflect’s Maya’s default Y axis as the world up axis. Then you ask for its transformation property, which will return this interesting value: (matrix3 [1,0,0] [0,0,1] [0,-1,0] [0,0,0]) That’s it! That was the hardest part of the whole problem Now you have Maya’s world transformation matrix inside Max, it can’t get any more exciting than that! Oks, just kidding, it actually does get more exciting than that! Now it’s just a matter of transforming your transformation matrices into this space. How to go about this is simple. Thanks to a quick research on the internet and a few mathematical articles, I came across this formula:(
mayaMatrix = (matrix3 [1,0,0] [0,0,1] [0,-1,0] [0,0,0])
inputMatrix = $foo.transform
theResultingMatrix = mayaMatrix * inputMatrix * inverse mayaMatrix
)

or, if you read user documentation you come across this handy function:

(note: the local scope of this script is introduced just to make sure we won’t accidentally mess any existing variables up in your current namespace. If you don’t know what I’m talking about, just disregard this comment )

The resulting matrix is an explicit transform matrix in Maya’s world space. It doesn’t get any more exciting than this! So, at the end of the day I wrote a function that’ll also format the matrix3 value in a 16 double value so that Maya understands it and I could start seamlessly transforming objects from Max in Maya (I’ll leave this part to you). It may not seem too useful at first, but think of the possibilities! Besides I needed this conversion system for a much larger project I’m working on at the current studio that hired me. Let me put it this way: in the end, it’ll save us a lot of time, worrying, sleepless nights and company’s money!