Jump to content
  • Advertisement
Sign in to follow this  
Jacob Jingle

X File Transforms

This topic is 3052 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 thought I had this down...But now I'm getting characters that look like their from the movie 'The Thing' or a Salvador Dali Painting, all stretched and deformed. Anyone know what's wrong with my transforms?
struct sBone
{
	sBone()
	{
		D3DXMATRIX identity;
		D3DXMatrixIdentity(&identity);
		m_frameTransform = m_toRoot = m_skinWeightOffset = m_Anim = m_finalTransform = identity;
	}
	void ToRoot(D3DXMATRIX parent)
	{
		m_toRoot = parent * m_frameTransform;
		for_each(m_vChildBones.begin(), m_vChildBones.end(), [&](std::tr1::shared_ptr<sBone> bone){ bone->ToRoot(m_toRoot);});
	}
	void FinalTransform(D3DXMATRIX parent)
	{
		m_finalTransform = m_skinWeightOffset * m_Anim * m_toRoot;
		for_each(m_vChildBones.begin(), m_vChildBones.end(), [&](std::tr1::shared_ptr<sBone> bone){ bone->FinalTransform(m_finalTransform);});
	}
	std::string m_name;
	D3DXMATRIX  m_frameTransform;
	D3DXMATRIX  m_toRoot;
	D3DXMATRIX  m_skinWeightOffset;
	D3DXMATRIX  m_Anim;
	D3DXMATRIX  m_finalTransform;
        std::vector<std::tr1::shared_ptr<sBone>> m_vChildBones;
};

m_frameTransform = Frame::FrameTransformMatrix m_skinWeightOffset = SkinWeights::Offset m_Anim = AnimationSet::Animation matrix [Edited by - Jacob Jingle on March 11, 2010 3:15:01 PM]

Share this post


Link to post
Share on other sites
Advertisement
I'm not sure how you're calculating the animation matrix, but normally:

Each frame-

m_frameTransform = animTransform( time t );

where animTransform = lerp/slerp_local_anim(time t);

Then:
m_toRoot = m_frameTransform * parentToRoot; //NOTE THE ORDER!

Then:
final = skinOffset * m_toRoot;

The skinOffset moves the vertices from rest pose to bone space. The final transform moves the vertices from bone space to animation world space.

In words, finalTransform = (move from world rest pose to bone space) * (move from bone space to animated world).

If, for whatever reason, you want to preserve the FrameTransformMatrix, then:

m_toRoot = animTransform * parentToRoot;

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!