Sign in to follow this  

format of frame transform matrices in .x files??

This topic is 4302 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_;
	else 
		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_[i], 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

This topic is 4302 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this