4 by 4 Matrix in maya

by denilson020898 posted 38 days ago | 1 comment

There is an entry about matrix resources. Here I want to delve a bit deeper about matrix, especially how we can construct/compose a matrix

I know in maya we have something called bounding box, which is acting like a container for geometry. The bounding box behaves like parallelogram. I tried to created an openGL locator node without defining the proper bounding box. Everytime I hit "F" key to focus the view, It messed up the camera.

http://sk.uploads.im/t/JVBvn.jpg "Matrix"

a11, a12, a13 to represent the x coordinate

a21, a22, a23 to represent the y coordinate

a31, a32, a33 to represent the z coordinate

a41, a42, a43 to represent offset / translation for each individual axis.

Some on internet said the fourth column represents the perspective foreshortening (Don`t know what that means.)

let`s say, I have a locator node that is the child transform1, and transform1 is the child of transform2. When I alter the position of transform1 and transform2. How do I calculate the locator position?

I really have to learn more about linear algebra.


by vshotarov posted 38 days ago

I am by no means an expert, but here is how I think about transformation matrices.

So, if you have the following hierarchy:

- transform2
    - transform1
        - locator1

All you have to do in order to calculate the locator1's position is to multiply the local matrices going upwards through the hierarchy. So in this case it would be:

locator1_matrix * transform1_matrix * transform2_matrix , where the matrices are in local space (the matrix attribute of a transform node)

That will give you the locator transformation in the space of whatever the parent of transform2 is, which in this case is world, hence this will be enough. That being said, in Maya you can use the worldMatrix attribute of any transform which is exactly the same as the multiplication above.

So to get your locator's world transform using the worldMatrix attr, you would do this:

locator1_matrix * transform1_worldMatrix which is equivalent to the locator1.worldMatrix attribute.

As other people have mentioned in the other post, there are a few videos at Cult of Rig that go over math concepts. Here are a couple

http://www.cultofrig.com/2017/06/17/pilot-season-day-8-trigonometry/ http://www.cultofrig.com/2017/06/04/pilot-season-day-5/

As for the perspective foreshortening I can't be of much help as I've always used higher level tools to construct my projection matrices in OpenGL (they were similar to this one), so I am not quite sure how that fits in the last column, especially since I haven't done any OpenGL drawing in Maya.