Jump to content
  • Advertisement
Sign in to follow this  
Fidde

Problems exporting and setting up skeleton/bones from 3ds Max

This topic is 4991 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

Hi! I am exporting animation and skeleton data from 3ds max using the IGame interface(with the OGL flag set to generate data for OpenGL). The problem that I don´t get the correct position/orientation for my bones. This it the part form my exporter that exports the bone´s data: for(itr = 0; itr < mBones.size(); itr++) { NANIM::cBone *newBone = new NANIM::cBone; if(mBones[itr]->name.length()) { newBone ->setBoneName(mBones[itr]->name); } else { newBone ->setBoneName("NONAME"); } newBone ->setBoneHandle(mBones[itr]->id); newBone ->setParentIndex(mBones[itr]->parent); NMATH::cQuaternion quat = GMatrixToQuat(mBones[itr]->localTM); NMATH::cVector3 pos(mBones[itr]->localTM.GetRow(3)[0], mBones[itr]->localTM.GetRow(3)[1], mBones[itr]->localTM.GetRow(3)[2]); newBone ->setPosition(pos); newBone ->setOrientation(quat); // Add new bone mSkeleton->createBone(newBone ); } When the skeleton and it´s bones are loaded into the engine, i do the following to calculate the absoulte and the relative matrix: // Go through all bones.. for(itr = 0; itr < mBones.size(); itr++) { std::map<int, cBone*>::iterator found = mBones.find(itr); NANIM::cBone &b = *found->second; if(found != mBones.end()) { found->second->preprocessBone(); if(found->second->getParentIndex() != -1) { std::map<int, cBone*>::iterator parent = mBones.find(found->second->getParentIndex()); found->second->setAbsoluteMatrix(parent->second-> getAbsoluteMatrix()); // Post-multiply this bones absolute matrix with parent´s relative matrix NMATH::cMatrix4x4 &m2 = found->second->getAbsoluteMatrix(); m2.postMultiply(*found->second->getRelativeMatrix()); found->second->setAbsoluteMatrix(m2); } else { found->second->setAbsoluteMatrix(*found->second-> getRelativeMatrix()); } } Finally, when I render the model, I transform the current vertice by it´s bone´s final matrix. If am not animating the bone, the final matrix would an indentity matrix, and nothing would happen. The result I get is that the mesh gets completely destroyed. Any help would be greatly appreciated! /Fidde

Share this post


Link to post
Share on other sites
Advertisement
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!