I call this function with the root joint and an identity matrix

void AnimationController::CombineTransforms(Joint* pJoint, const D3DXMATRIX& P) { D3DXMATRIX transf = pJoint->mLocalTransf /** pJoint->mAnimatedTransf*/ * P; mFinalTransforms.push_back( pJoint->mOffsetTransf * transf ); for (unsigned i = 0; i < pJoint->mChildren.size(); i++) { CombineTransforms(pJoint->mChildren[i], transf); } }

I get the matrices from assimp:

mLocalTransf = transformation in aiNode with the bone's name

mOffsetTransf = offset transformation in aiBone struct

Now in my understanding, mFinalTransforms should be filled with identity matrices. But it isn't! By sending this to my vertex shader, i get the following result:

cbuffer c_buffer { float4x4 World; float4x4 WorldViewProj; float4x4 FinalTransforms[100]; float3 Diffuse; } VS_OUT VShader(float4 position : POSITION, float4 normal : NORMAL, float2 texcoord : TEXCOORD, float4 weights : BLENDWEIGHT, int4 boneIndices : BLENDINDICES) { VS_OUT output; // Apply skinning float4 p = float4(0.0f, 0.0f, 0.0f, 1.0f); float lastWeight = 0.0f; int n = 3; for(int i = 0; i < n; ++i) { lastWeight += weights[i]; p += weights[i]* mul(position, FinalTransforms[boneIndices[i]]); } lastWeight = 1.0f - lastWeight; p += lastWeight * mul(position, FinalTransforms[boneIndices[n]]); p.w = 1.0f; output.position = mul(WorldViewProj, p); output.color = float4(0.7, 0.7, 0.7, 1); output.texcoord = texcoord; return output;}

What is going on??

Oh and this is how it's supposed to look like: