Jump to content
  • Advertisement
Sign in to follow this  
lucky6969b

.X Mesh Shattered after setting "World" transformation

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

Here's my trouble.
When the function UpdateFrame was called (see below) with world transformation set to identity, the mesh rendered okay. When I added "world" transformation to it, it was torn apart. Anywhere I should start attacking this problem, couldn't solve it in half a day already.


void CObjects::UpdateFrame(LPD3DXFRAME pFrame, D3DXMATRIX *pMat)
{
FRAME *pCurFrame = (FRAME*)pFrame;


//pCurFrame->matCombined = *pMat;
if (pMat != NULL)
D3DXMatrixMultiply(&pCurFrame->matCombined, &pCurFrame->TransformationMatrix, pMat);
else
pCurFrame->matCombined = pCurFrame->TransformationMatrix;

if (pCurFrame->pFrameFirstChild != NULL)
UpdateFrame(pCurFrame->pFrameFirstChild, &pCurFrame->matCombined);

if (pCurFrame->pFrameSibling != NULL)
UpdateFrame(pCurFrame->pFrameSibling, pMat);

}

...
UpdateFrame (m_pMesh->GetFrameRoot(), m_matWorld); // identity or set to some "world" transformation








I could see when the world transformation was set, the variable matCombined went exploded. But how come it wouldn't happen with identity set?
Some points added:
1) There are some objects that use the same code base which can be rendered correctly. It was a human model.
2) The model was merged from a second model and was grouped into one chunk (if that matters) (max 2011)

Update:
There seems to be no difference in using identity or not, but the mesh can be rendered in mesh viewer, not in my program. However, another model can be.
Some subtle bugs...


Thanks
Jack

[Edited by - lucky6969b on December 28, 2010 4:52:05 AM]

Share this post


Link to post
Share on other sites
Advertisement
Quote:
The model was merged from a second model and was grouped into one chunk (if that matters) (max 2011)

If other models are rendered correctly by the same code, then it would seem whatever "grouping" into one "chunk" did is the source of the problem. Could you explain what that means? Did you create another animated x-file from somewhere, and you load that "merged" file using D3DXLoadMeshHierarchyFromX? Do you use the animation controller that gets created from that call, or are you using a cloned animation controller?

Also:

if (pMat != NULL)
D3DXMatrixMultiply(&pCurFrame->matCombined, &pCurFrame->TransformationMatrix, pMat);
else
pCurFrame->matCombined = pCurFrame->TransformationMatrix;

That code is suspicious. Why do you check for a NULL parent matrix? Every child's parent must have a matrix.

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!