Sign in to follow this  
lucky6969b

Should I avoid transforming the mesh with a skinned mesh?

Recommended Posts

Hello, When I was exporting the mesh out from 3ds max, the mesh was part of the hierarchy. With the root called Bip001 and the rest of the bones under it. Then with the sibling of this Bip001, there goes the mesh. When I throw everything into a bvh engine, the body is part of the transformation like this
bind.axisAlignQuats[36]
1 0 0 0

diff
1 0 0 0

inv(bind.axisAlignQuats[36])
1 -0 -0 -0

bind.boneAlignQuats[36])
1 0 0 0

Init Matrix Bone1
1 0 0 0
0 1 0 0
0 0 1 0
0 0 0 1

bind.axisAlignQuats[0]
1 0 0 0

diff
1 0 0 0

inv(bind.axisAlignQuats[0])
1 -0 -0 -0

bind.boneAlignQuats[0])
1 0 0 0

Init Matrix Body01
1 0 0 0
0 1 0 0
-0 0 1 0
-0.000388 0.089541 0 1
Should I just avoid to transform the mesh, just keep transforming the bones, and call the UpdateSkinnedMesh on the render call if I use software skinning? Thanks Jack

Share this post


Link to post
Share on other sites

Depends how you implement it.
Usually the the final bone transformation represents the full transformation hierarchy(aka. the parent bones transform is applied in this matrix and the 'offset' matrix).
Additionally you could include the object-to-world space transform if that suits your pipeline.

Edited by imoogiBG

Share this post


Link to post
Share on other sites

I am doing it a little bit different here

In this code snippet, animResult is already a final bone transformation,

I tried to

1) invert it the make it local, and Update the hierarchy and multiply with offset in the renderer to get the final

OR

2) move it directly into the bone matrix pointers and multiply with offset in the renderer to get the final

Either way doesn't get me the correct results?

for (BONE_ID i = 0; (unsigned)i < m_frames.size(); i++)    {
        const Frame& f = m_frames[i];

        FRAME* fr = (FRAME*)D3DXFrameFind(GetFrameRoot2(), f.name);
        if (fr == NULL)
            continue;
    
        // animResult.boneMat[i] is in world space already
        vertexTransformMat[i] = inv(animResult.boneMat[i]);

        D3DXMATRIX matAnimRes;
        matAnimRes._11 = vertexTransformMat[i]._11;
        matAnimRes._12 = vertexTransformMat[i]._12;
        matAnimRes._13 = vertexTransformMat[i]._13;
        matAnimRes._14 = vertexTransformMat[i]._14;
        matAnimRes._21 = vertexTransformMat[i]._21;
        matAnimRes._22 = vertexTransformMat[i]._22;
        matAnimRes._23 = vertexTransformMat[i]._23;
        matAnimRes._24 = vertexTransformMat[i]._24;
        matAnimRes._31 = vertexTransformMat[i]._31;
        matAnimRes._32 = vertexTransformMat[i]._32;
        matAnimRes._33 = vertexTransformMat[i]._33;
        matAnimRes._34 = vertexTransformMat[i]._34;
        matAnimRes._41 = vertexTransformMat[i]._41;
        matAnimRes._42 = vertexTransformMat[i]._42;
        matAnimRes._43 = vertexTransformMat[i]._43;
        matAnimRes._44 = vertexTransformMat[i]._44;

        // local transform
        fr->TransformationMatrix = matAnimRes;
  
    }

    // collapse into ppBoneMatrixPointers
    D3DXMATRIX iden;
    D3DXMatrixIdentity(&iden);
    Mover::UpdateFrame((FRAME*)GetFrameRoot2(), &iden);


    // multiply with pBoneOffsetMatrices to get pBoneMatrices
    Renderer::Render(new RenderMesh(boost::make_shared<CMesh>(*this)));
Edited by lucky6969b

Share this post


Link to post
Share on other sites

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