• Advertisement

Archived

This topic is now archived and is closed to further replies.

DX8 - extracting mesh from skinned mesh

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

Hi all, I am trying to apply volume shadows to my program, and for normal meshes, all works well (apart from when the camera goes into the volume - but that''s another story). My skinned mesh stuff is just a butchered version of the Dx8 sample, and I am having trouble extracting the mesh which I need to feed to my shadowing object. At what point do I need to grab the pMesh from the mesh container? Will I have to do away with processing D3DNONINDEXED and just do the SOFTWARE one and use UpdateSkinnedMesh? Thanks for any help. Steele.

Share this post


Link to post
Share on other sites
Advertisement
So far I have come up with this :


c_SkinnedMesh::Get_Mesh(SFrame *pframeCur) {
SMeshContainer *pmcMesh = pframeCur->pmcMesh;
D3DXMATRIX mtxWorld;
while (pmcMesh != NULL) {
METHOD tmp = m_method;
m_method = SOFTWARE;
GenerateMesh(pmcMesh, *m_Caps);
m_method = tmp;

DWORD cBones = pmcMesh->m_pSkinMesh->GetNumBones();
D3DXMATRIXA16 *pBoneMatrices = new D3DXMATRIXA16[cBones];

// set up bone transforms
for (DWORD iBone = 0; iBone < cBones; ++iBone)
{
D3DXMatrixMultiply(
&pBoneMatrices[iBone], // output
&pmcMesh->m_pBoneOffsetMat[iBone],
pmcMesh->m_pBoneMatrix[iBone]);
}

//D3DXMatrixIdentity(&mtxIdentity);
Generate_World_Matrix(&mtxWorld);

// generate skinned mesh
HRESULT hr = pmcMesh->m_pSkinMesh->UpdateSkinnedMesh(pBoneMatrices, NULL, pmcMesh->pMesh);
if (FAILED(hr)) {
DebugPrint(false, ("Failed to update skinned mesh on update\n"));
} else {
if (!gmGM->m_svLight_Shadows->Add_Shadow(string("SKINNED TMP"), pmcMesh->pMesh, &mtxWorld)) {
gmGM->m_svLight_Shadows->Update_Shadow(string("SKINNED TMP"), pmcMesh->pMesh, &mtxWorld);
}
}

pmcMesh = pmcMesh->pmcNext;
}

SFrame *pframeChild = pframeCur->pframeFirstChild;
while (pframeChild != NULL) {
Get_Mesh(pframeChild);
pframeChild = pframeChild->pframeSibling;
}

}

c_SkinnedMesh::Update(float fDelta) {
SDrawElement *pdeCur;
SFrame *pframeCur;
SFrame *frmRoot;
SMeshContainer *pmcMesh;
D3DXMATRIX mtxIdentity;


pdeCur = m_pdeHead;
while (pdeCur != NULL)
{
pdeCur->fCurTime += fDelta;
if (pdeCur->fCurTime > 1.0e15f)
pdeCur->fCurTime = 0;

pframeCur = pdeCur->pframeAnimHead;
while (pframeCur != NULL)
{
pframeCur->SetTime(pdeCur->fCurTime);
pframeCur = pframeCur->pframeAnimNext;
}

Get_Mesh(pdeCur->pframeRoot);

pdeCur = pdeCur->pdeNext;
}
}


The mesh doesn''t seem to be correct, however, containing just a mish-mash of polys.
Am I going the right way about this?
Thanks,
Steele.

Share this post


Link to post
Share on other sites
Anyone have any idea on how to extract a mesh representing the current skinned mesh position?
Steele.

Share this post


Link to post
Share on other sites
You''ll probably want to go with software skinning. If your mesh was set up right and you had access to vertex shaders, you could do indexed skinning and stay on the GPU, but at first, go with software to get it working.

Extracting the mesh with software skinning is just that--skin it, like always, and use that. If you need the vertices to get put into memory, that''s really the way to go.

I like pie.

Share this post


Link to post
Share on other sites

  • Advertisement