Jump to content
  • Advertisement
Sign in to follow this  

format of frame transform matrices in .x files??

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

So, I'm writing a directX x file parser that will load into my 3DModel class in c++. The idea is that if I write a parser (w/o using specific dX functions) I will be API independent. Anyways, I loaded in the mesh fine, but I'm having a HUGE amount of trouble trying to skin it... or even display the bones correctly. I'm using the generic "Tiny" model to test all my code. So.. my problem is that I'm not sure what the matrices I'm reading in actually mean. I've read a lot on skinning, but can't figure it out for this specific file format. Do the matrices describe transformations relative to the parent bone? Are they relative to the initial root bone? My code right now looks like this::
void Skeleton::UpdateBone(Gfx::pbone_t parentBone, Gfx::pbone_t currBone, std::vector<VertLine> &lineBuffer) 
if (parentBone)
		currBone->localMatrix_ = currBone->refMatrix_ * parentBone->localMatrix_;
		currBone->localMatrix_ = currBone->refMatrix_;

	currBone->finalMatrix_ = currBone->skinMatrix_ * currBone->localMatrix_;

	//Loop through all children and call UpdateBone on the bones
	for (uint32_t i=0; i < currBone->children_.size(); ++i)
		UpdateBone(currBone, currBone->children_, lineBuffer);

Line buffer is the array of points to express the bones as lines, but I removed the code for cleanliness Here, refMatrix refers to the reference pose matrix (that I read in from the FrameTransformation template), and skinMatrix refers to the matrix read in from the SkinWeight template. Am I doing something wrong? I feel like I've tried all possible combinations of matrices and it just won't work... I'm created small x files to try contrived examples of bone linking (right angles and stuff) and it works fine... any ideas?

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!