Jump to content
  • Advertisement
Sign in to follow this  
Quaid Tseng

MAYA to DX, Joint orient, bone offset and anim rotation keys?

This topic is 3195 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I'm working to export skinning animations from MAYA to DirectX. And for the codes of my MAYA exporter, I consult Robthebloke's site. Some codes make me confused. Here I show some relevant lines. In OutputTransform()
BoneIT it = g_Bones.begin();
for( ; it != g_Bones.end(); ++it ){
    MFnTransform fnX(bone.path);
    MQuaternion RO(0,0,0,1);
    MQuaternion R(0,0,0,1);
    //BaseMatrix
    MMatrix mat = fnX.transformation().asMatrix();
    //Rotation
    fnX.getRotation(R);
    //Rotation/Joint Orientation
    RO = fnX.rotateOrientation(MSpace::kObject);
}


Can anyone tell me what should I do with the Joint orientation and baseMatrix when I export them to directX? And in OutputAnimation()
BoneIT it = g_Bones.begin();
for( ; it != g_Bones.end(); ++it ){
    for(int i = StartTime; i <= EndTime; ++i){
        MAnimControl::setCurrentTime(MTime(i, MTime::kPALFrame));
        MQuaternion quat;
        fnX.getRotation(quat);
    }
}


I saw that with the exporter in DXSDK, the outputted rotation keys(w,x,y,z) is different than the quaternion here. And there's one more bone offset matrix. I know how to render a .X file. I already read Jim Adams' book. And I've already successfully implement a .X renderer. But here I don't know how to get the bone offset matrix in my MAYA exporter, I guess it's related to the joint orientation, but how? And it seems an additional converting is needed to convert the rotation quaternion keys, coz its quat keys are different than the ones using the exporter in DXSDK. Or without the converting to .X form, how can I render the anim with the rot keys directly from my MAYA exporter? Any idea is welcome :) And thanks.

Share this post


Link to post
Share on other sites
Advertisement
After some search I found this
http://www.gamedev.net/community/forums/topic.asp?topic_id=517946
And I've tried Rotation = RO * R * JO
That's Rotation = Rotate Orient * Rotation * Joint Orient

And the codes are like

BoneIT it = g_Bones.begin();
for( ; it != g_Bones.end(); ++it ){
MQuaternion JO(0,0,0,1);
MQuaternion RO(0,0,0,1);
MQuaternion Rcomb;
MMatrix RcombMat;

if( fnX.object().hasFn(MFn::kJoint) ){
// Joint Orientation
MFnIkJoint fnJ(fnX.object());
fnJ.getOrientation(JO);
}
// Rotate Orientation
RO = fnX.rotateOrientation(MSpace::kObject);
for(int i = StartTime; i <= EndTime; ++i){
MAnimControl::setCurrentTime(MTime(i, MTime::kPALFrame));
// get rotation
MQuaternion quat;
fnX.getRotation(quat);
RcombMat = RO.asMatrix() * quat.asMatrix();
RcombMat = RcombMat * JO.asMatrix();
Rcomb = RcombMat;
}
}





But the rot quat "Rcomb" is still different than what I saw in the .X file exported with the official exporter. Sometimes its very close, but most of time they are differnet.

Hope anybody can help me. Thanks~

[Edited by - Quaid Tseng on December 24, 2009 12:27:19 PM]

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!