3dsmax vs panda3d matrix?

Hi guys, i’m making a script for maxscript to export object from 3dsmax to panda3d as you can see in 3dsmax (with texture-cards inside).
I am almost at the end, but a problem has occurred with matrix transformation.

I use this function for transform and export object matrix:

		fn strTransMatrix obj tabs:"" = (
			--msx=[in coordsys #parent obj.scale.x,0,0]
			--msy=[0,in coordsys #parent obj.scale.y,0]
			--msz=[0,0,in coordsys #parent obj.scale.z]
			--m3tra=((in coordsys #parent obj.rotation) as matrix3)*(matrix3 msx msy msz (in coordsys #parent obj.pos))

			m3tra=obj.transform
			row1str = substituteString (m3tra.row1 as string) "," " "
			row1str = ((trimRight row1str "]") as string)+" "
			row1str = " "+(trimLeft row1str "[")	
			row2str  = substituteString (m3tra.row2 as string) "," " "
			row2str = ((trimRight row2str "]") as string)+" "
			row2str = " "+(trimLeft row2str "[")	
			row3str = substituteString (m3tra.row3 as string) "," " "
			row3str = ((trimRight row3str "]") as string)+" "
			row3str = " "+(trimLeft row3str "[")	
			row4str = substituteString (m3tra.row4 as string) "," " "
			row4str = ((trimRight row4str "]") as string)+" "
			row4str = " "+(trimLeft row4str "[")	

			return tabs + row1str +"0\n"+tabs+ row2str +"0\n"+tabs+ row3str +"0\n"+tabs+ row4str +"1"
		)

I know that both are z-up-right axis coordinates (correct me if I’m wrong), but i don’t know the relationship between 3dsmax and panda3d for both typesetting and memory storage matrix.

I have been looking for on Google, but i haven’t found anything that could help me.

Someone can help me?

thanks

Maybe this is what you are looking for
www.panda3d.org/manual/index.php/Matrix_Representation

Thanks Wezu, but i have already read this document.
My problem is that I do not know the typesetting and memory storage of 3dsmax.

Does anyone know the data transformation matrix of 3dsmax?

thanks again

Not sure if this helps, but looking at the panda3D source code I found this function (pandatool/src/maxegg).

////////////////////////////////////////////////////////////////////
//     Function: MaxToEggConverter::get_object_transform
//       Access: Private
//  Description: Extracts the transform on the indicated Maya node,
//               and applies it to the corresponding Egg node.
////////////////////////////////////////////////////////////////////
LMatrix4d MaxToEggConverter::
get_object_transform(INode *max_node) {

    // Gets the TM for this node, a matrix which encapsulates all transformations
    // it takes to get to the current node, including parent transformations.
    Matrix3 pivot = max_node->GetObjectTM(_current_frame * GetTicksPerFrame());

    Point3 row0 = pivot.GetRow(0);
    Point3 row1 = pivot.GetRow(1);
    Point3 row2 = pivot.GetRow(2);
    Point3 row3 = pivot.GetRow(3);
    
    LMatrix4d m4d(row0.x, row0.y, row0.z, 0.0f,
                  row1.x, row1.y, row1.z, 0.0f,
                  row2.x, row2.y, row2.z, 0.0f,
                  row3.x, row3.y, row3.z, 1.0f );
    return m4d;
}

thanks enn0x.
The table LMatrix4d m4d in the code that you have brought is like mine above, but i have a broblem when import an object and reparent something to it (seems flipped and a little bit shifted).

Thus, i think that this isn’t the right matrix (in fact i read on description “Maya node”).

I do not know what to do, no one knows how to fix it?

thanks

Which is the rotation unit of the trans matrix in panda3d?
Euler Angle or Quaternion?

I don’t think that question makes sense–the rotation in Panda’s matrix is stored in a 4x4 transform matrix, as rotations are stored within a matrix. It’s neither Euler angles nor is it a Quaternion, both of which are alternate, non-matrix ways to represent a rotation. (Of course, you can convert from Euler angles or a Quaternion into a matrix using some of Panda’s interfaces.)

I don’t know how to help you find the answer you’re looking for. I know nothing about 3DS Max, as I suspect most people here also know little. But a matrix is a matrix. If 3DS Max has a 4x4 matrix, you should be able to import it componentwise into Panda’s matrix, and it should work the same way. The only question is you might need to exchange rows for columns and vice-versa (that is, you might need to transpose the matrix), since not everyone agrees on this convention. Besides that, all 4x4 transform matrices are pretty much the interchangeable across all 3-D packages.

David

I finally solved the problem!
I forgot to inverse the rotation part of 3dsMax matrix.
3dsmax script rotation matrix isn’t equal to 3dsmax scene rotation matrix.
I don’t undertand why, but it is so.

I think to post the script when I have implemented more features (If someone will be interested).

Thank you all for the help.