AREA forums upgrade
Read more about the planned upgrade of our forums
  • 1/3
You are here: Forum Home / Autodesk® Maya® / Autodesk Maya 2013 / In Maya, how do I convert trans, rot, scale data to a 4 x 4 transformation matrix?
IMPORTANT ANNOUNCEMENT ABOUT AREA FORUMS
  RSS 2.0 ATOM  

In Maya, how do I convert trans, rot, scale data to a 4 x 4 transformation matrix?
Rate this thread
 
66751
 
Permlink of this thread  
avatar
  • Total Posts: 6
  • Joined: 21 August 2009 12:35 PM

I have been given the following Maya camera data:

trans X: 1.542
trans y: 3.319
trans z: -1.821

rot X: 117.882
rot Y: 2.189
rot Z: 154.074

scale X: 1
scale Y: 1
scale Z: 1

What is the formula for converting this to a 4 x 4 transformation matrix?

Thanks,
Doug



Replies: 1
/img/forum/light/default_avatar.png

select the object, then run this MEL command.

xform -q -ws -m;

Author: noisy sphere

Replied: 09 May 2012 10:34 AM  
avatar

Hey,

The easiest way within maya is to either use the maya api ( which you can call through python ) and use the MTransformationMatrix class which you can set rotation/translation etc, then feed out the matrix.

Alternatively, if you’re not that keen on scripting you could potentially cheat it and pump those values into a temporary object and then read the matrix from that using the xform command.

If you’re running over a lot of objects the first method will be much quicker.

Hope that helps.

Mike.



Replies: 1
/img/forum/light/default_avatar.png

@mikesnail,

I have a partner handling the Maya wrangling. I have my own 3D code (Objective-C) that consumes the above data. All I really need to know is the order of matrix concatenation.

For example is it (ignoring scale for the moment): T * Rx * Ry * Rz -> TransformationMatrix?

Where can learn more about the API? Is there an Objective-C binding?

Cheers,
Doug

Author: Elastic Image Software

Replied: 03 May 2012 12:31 AM  
avatar

use the composeMatrix node



Replies: 2
/img/forum/light/default_avatar.png

@MinsieurH,
Thanks very much. I am actually working with a partner on this project who is handling the Maya end. I have my own custom 3D software that takes a 4x4 matrix as input. What should I tell my partner to setup the composeMatrix node?

-Doug

Author: Elastic Image Software

Replied: 03 May 2012 12:24 AM  
/img/forum/light/default_avatar.png

@MinsieurH,

I just tried Google’ing composeMatrix node and found nothing (?). I also could not find any mention of it in the Maya help docs.

I went ahead and downloaded Maya2013 for my Mac and loaded the .ma file from my partner. How do I setup the composeMatrix node? What exactly does it do?

For context, I am an experienced 3D graphics programmer new to Maya.

Cheers,
Doug

Author: Elastic Image Software

Replied: 03 May 2012 03:28 AM  
avatar
  • Avotas
  • Posted: 03 May 2012 06:25 AM

Hey,

Your going to want to drop into this forum at http://area.autodesk.com/forum/autodesk-maya/sdk/ It’s not as active as the other forums, but people do check in now and then.

As for education, Autodesk has free webcasts for API programming now and then. You can also check out Autodesk University at http://au.autodesk.com/?nd=class_listing

-Avotas



Replies: 2
/img/forum/light/default_avatar.png

@Avotas,

Actually all I want to do is be able to start at the 16 numbers corresponding the the transformation matrix of of the following:

- my camera
- single rectangle it is aimed. 

I just downloaded a shiny new copy of Maya20123. I have loaded my trivially simple seen file into Maya.

Now, how do I display the 16 numbers of the transformation corresponding to each.

Surely I don’t have to resort to writing a mel/python script just to see these numbers! That seems like massive overkill for what is very, very, simple question or am I missing something?

Cheers,
Doug

Author: Elastic Image Software

Replied: 03 May 2012 06:50 AM  
/userdata/avatar/32b379d0f.png

Hi Doug,

The reason I referenced the other form is because of the skill set of the people who populate it. This is a generalist form, mostly populated by artists who may or may not know what a transformation matrix is ... except maybe a famous movie franchise tie-in. (That’s not a slam against anyone, its just outside the normal scope of knowledge for most)

To visually see how everything exists in Maya:

• Click Window -> Hypergraph:Connections.
• Select the nodes you want to examine, then select Graph -> Input and Output Connections.
• Clicking on these nodes will expose the values in the Channel Box editor (right side-bar, main render window). Clicking the connecting lines demonstrate how Maya handles the connections between them.

vvv Everything below this line is guesswork, it has been a decade sense I worked with matrix’s, so take it with a grain of salt. vvv

Now that you can see the data, you just need to convert your row-major (X,Y,Z,T) format into a 4x4 matrix.

(X,Y,Z,T)
(m0, m1, m2) : +X axis, left vector
(m4, m5, m6) : +Y axis, up vector
(m8, m9, m10) : +Z axis, forward vector

Author: Avotas

Replied: 03 May 2012 08:39 AM  
avatar

@Avotas,

Nice. Thanks for this. This will help a great deal.

Cheers,
Doug



Replies: 0