Sign in to follow this  

.X Mesh Shattered after setting "World" transformation

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

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