Jump to content
  • Advertisement
Sign in to follow this  
ZoBuzz

Direct3D9 SoftWare SkinMesh Problems

This topic is 3043 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'm trying to implement a skinnedMesh using software skinning like in D3D9 demo .
my code like this:


void DrawMeshContainer()
{
...
for (iBone = 0; iBone < cBones; ++iBone)
{
D3DXMatrixMultiply(&BoneMatrices[iBone], &pMeshContainer->pBoneOffsetMatrices[iBone],
pMeshContainer->ppBoneMatrixPtrs[iBone]);
}
pMeshContainer->pOrigMesh->LockVertexBuffer(D3DLOCK_READONLY, (LPVOID*)&pbVerticesSrc) ;
pMeshContainer->MeshData.pMesh->LockVertexBuffer(0, (LPVOID*)&pbVerticesDest);
// generate skinned mesh
pMeshContainer->pSkinInfo->UpdateSkinnedMesh(BoneMatrices, NULL, pbVerticesSrc, pbVerticesDest);
pMeshContainer->pOrigMesh->UnlockVertexBuffer();
pMeshContainer->MeshData.pMesh->UnlockVertexBuffer();

for (iAttrib = 0; iAttrib < pMeshContainer->NumAttributeGroups; iAttrib++)
{
V( pd3dDevice->SetMaterial(&(pMeshContainer->pMaterials[pMeshContainer->pAttributeTable[iAttrib].AttribId].MatD3D)) );
V( pd3dDevice->SetTexture(0, pMeshContainer->ppTextures[pMeshContainer->pAttributeTable[iAttrib].AttribId]) );

pMeshContainer->MeshData.pMesh->DrawSubset(iAttrib);
}
...
}


Then my skinMesh mess up.The code mostly copied from D3D9 demo, the pBoneOffsetMatrices*ppBoneMatrixPtrs generate the boneMatrix, UpdateSkinnedMesh Api aply the boneMatrix to vertex.
As test, i change UpdateSkinnedMesh to

pMeshContainer->pSkinInfo->UpdateSkinnedMesh(NULL, NULL, pbVerticesSrc, pbVerticesDest);


Then I got a static mesh,cause the vertex were not affected .then I change the boneMatrix to IdentityMatrix,I expect it would be a static mesh,but It mess up.

pMeshContainer->pSkinInfo->UpdateSkinnedMesh(MatIdentity, NULL, pbVerticesSrc, pbVerticesDest);



So I got confused, because I also use HLSL gpu skinning in the D3D9 Demo,it works well.
Or may be because I used a right hand coordinate?
Can any one help me,sorry for my english,thanks.

Share this post


Link to post
Share on other sites
Advertisement
Personally I used this demo software skinning:

http://www.toymaker.info/Games/html/load_x_hierarchy.html

You can just copy/paste 4 files, edit few lines and it's ready to be used.
Hope this helps.

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!