905 . 409 . 1589 paul@paulneale.com
Select Page
Into the Transform Matrix

The transform matrix is usually ignored by most of us working in 3D  as we don’t have a clue what to do with it or how it works, in fact most probably don’t even know what it is for or have ever seen it in our day to day travels around the software we use. Once again I want to point out this tutorial is not for the math nerds to geek out on but for the artists that are trying to understand their craft a little more.

What is it?

Well other then being partially responsible for a great set of movies a transform matrix in 3D space is a set of numbers in a 4 x 4 matrix that defines the translation, rotation and scale of a node (Object).

When a node is transform, rotated and scaled the values are then converted down into a matrix and passed onto the children in the scene and it is the transform matrix (TM) that is inherited and used to calculate the position of the children as the parents values change. You could say it is the glue that binds them together.

Even though the TM contains Translation, Rotation and Scale of a node it doesn’t store those numbers how you might think. First off the last column in a 4x4 matrix isn’t used and really doesn’t need to be there but for the purpose of completeness it is shown.

Translation is straight forward so we can start there. In the example image the forth row contains the current world position, since the last column is not used we can see that the node is at 0 0 0 world space.

The Rotation and Scale of the node is a little more to wrap your head around at first as the numbers don’t look anything like what we see when animating and object where you are entering XYZ rotation angles and XYZ scale multipliers.

The Matrix3 shown below might help make a little more sense of it all. This is how 3DS Max shows the TM in Max Script when you type something like \$box001.transform in the listener and press enter. You can see that the forth column is excluded as it really isn’t needed. Maya shows the entire 4x4 matrix as just a set of numbers so it is a little harder to read but it is the exact same thing. This specific TM defines a node that has not been translated, rotated or scale away from the origin of the world matrix (Identity Matrix).

How is the Rotation and Scale of an object stored in a matrix?

Well they are a set of three vectors, a vector is just a point in space on a Cartesian graph, yup, maybe you should have paid attention in math class in grade 9. Each vector plots a point that points in the direction of each of the three axes. If you look at the X Vector value you can break it down into X, Y, Z values and if plotted on a three dimensional Cartesian graph it would place a point one unit along X, zero on Y and zero on Z. Another way that might help to visualize them would be to think of your translation gizmo with the three arrows for moving an object in the scene in local space and then visual at the tip of each of the arrows a vector (point) that represents each of the X, Y, Z vectors.

So how on earth do you rotate an object with a TM?

Well at no point do you rotate the object in the way that you might think. Below is a matrix that defines a node that is sitting at 0 0 0 world space and has been rotated around the Z axis 90°. Notice that out of the three vectors that define rotation it is the Z vector that has not changed from the above. All that has happened here is we have moved the X and Y vectors so that the X vector points down the world Y axis and the Y axis now points down the world -X axis. So really there is no rotation happening at all, it is just moving vectors on the Cartesian graph.

If the X, Y and X vectors represent rotation and scale how do you change the scale values? To get started on answering that question we first need to understand what a Normalized or Unit vector is. If we just use the Xv value from above we can see that if we were to measure from the center of the Cartesian graph to the end of the X vector we would have a length of exactly 1. This is the same for each of the three vectors that describe the rotation and scale of the node.

In the example TM below we have a matrix that has no rotation change but instead has been scaled along the Z axis to 200%. In this case it is the Z vector that has changed from a value of 0 0 1 to 0 0 2 which is multiplying the scale of the object along the Z vector by a factor of 2. If you have ever wondered why scaling objects can cause all sorts of odd behavior especially in a complex hierarchy you can now see that the same set of vectors that is responsible for rotations is also responsible for scaling. One will affect the other.

So what does a 45° rotation around Z look like?

Since the vectors need to remain as Unit Vectors with a length of one for the origin the values might not be what you expect if you were thinking [1,1,0] for the X vector. Since [1,1,0] has a length of 1.41421 we would have scaled the node as well as rotating it. So to rotate around Z we will have to move the X and Y vectors to a location that remains with a length of 1.

The graphic that shows the 45° Rotation on Z illustrates where the points will be on the Cartesian graph and once again the Z vector remains unchanged.

I have a far more in depth look at the transform matrix on my Youtube channel called , it is a little rough as it was was recorded as a three hour on line master class. Also if you are not a Max user don’t worry as it is using Max script to explain it the tutorial is about the math behind 3D and less about 3DS Max it self. All 3D software works exactly the same as all the math that we use day to day and don’t even know it was dreamed up by some very smart dudes long before computers ever existed.

For over 2 decades, I have been recognized internationally by the 3D animation industry as technical director and rigging specialist for clients worldwide, my work spans feature films, TV series, AAA game titles, broadcast television, aerospace, medical and tools and pipeline development.