Jump to content
  • Advertisement
Sign in to follow this  
Saad Manzur

Skeleton and Animation

This topic is 2052 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 am trying to import a rigged .dae character using assimp sdk . So far I have been able to store the bone offset matrices and weights. I modified the hlsl file in order . Here is the snippet....


VertexOut vout;

	float weights[4] = { 0.0f, 0.0f, 0.0f, 0.0f };
	weights[0] = vin.Weights.x;
	weights[1] = vin.Weights.y;
	weights[2] = vin.Weights.z;
	weights[3] = 1.0f - weights[0] - weights[1] - weights[2];
	float3 posL = float3(0.0f, 0.0f, 0.0f);
	float3 normalL = float3(0.0f, 0.0f, 0.0f);

	for (int i = 0; i < 4; i++)
		posL += weights[i] * mul(float4(vin.PosL, 1.0f), gBoneTransforms[vin.BoneIndices[i]]).xyz;
		normalL += weights[i] * mul(vin.NormalL, (float3x3)gBoneTransforms[vin.BoneIndices[i]]).xyz;

	vout.PosW = mul(float4(posL, 1.0f), gWorld).xyz;
	vout.NormalW = mul(normalL, (float3x3)gWorldInvTranspose);
	vout.PosH = mul(float4(posL, 1.0f), gWorldViewProj);
	vout.Tex = mul(float4(vin.Tex, 0.0f, 1.0f), gTexTransform).xy;

	return vout;

well this is my first model waiting to be imported . Some thing is bothering me though . Total number of weights is less than total number of vertices. Then again I am really confused if I am doing it right . I stored all the bones in order, only the animation part is not imported. When I try to render the model I do not get anything in the output window . Can anyone give me any pointer ? I am using visual studio 2013


Share this post

Link to post
Share on other sites

First, I'm not familiar with assimp so I can't comment on whether you've loaded the data correctly. However, regarding skinned mesh animation in general, you do, indeed, appear to be confused! Your post implies a lot of very different questions. Basically, you're asking for an understanding of the skinned mesh animation process. That's far too large a subject for a single thread. You may want to read through my article on animating skinned meshes as it's based on just the process you appear to be implementing.


However, I'll try to respond to a couple parts of your post.

Total number of weights is less than total number of vertices.

The number of weights per vertex has nothing to do with the number of vertices. In practice, each vertex is normally weighted by one to four bones. Each of those bones will weight that particular vertex with a particular weight.



Those transforms (matrices) are the animation transforms calculated during animation. See the article I linked. Those transforms are copied to the shader after they're calculated. If you haven't calculated those transforms (which would require the animation controller to have an animation set loaded and be running), and you haven't loaded the transforms into the shader, you shouldn't expect to see anything reasonable.

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.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!