Hy , i read this article on skin animation:
http://exdream.no-ip.info/blog/2007/02/25/SkeletalBoneAnimationAndSkinningWithColladaModelsInXNA.aspx
The article explain how do the skin animation with a shader approach.
The vertex shader have a list of matrix for the transform that are updated by the skinned mesh on a new pose(animation).
My problem is that i'm not understand how i do it with more than one type mesh or with different poses of the mesh!
The shader must be updated with the render matrix for each bone at each frame.
But if i have different mesh with different skeleton or different bone poses how i resolve?
this is the render code:
public void Render(Matrix renderMatrix)
{
BaseGame.Device.VertexDeclaration =
SkinnedTangentVertex.VertexDeclaration;
BaseGame.WorldMatrix = objectMatrix;
ShaderEffect.skinnedNormalMapping.SetBoneMatrices(
GetBoneMatrices(renderMatrix));
ShaderEffect.skinnedNormalMapping.Render(
material, "DiffuseSpecular20",
RenderVertices);
}
and this is the render vertex:
private void RenderVertices()
{
BaseGame.Device.Vertices[0].SetSource(vertexBuffer, 0,
SkinnedTangentVertex.SizeInBytes);
BaseGame.Device.Indices = indexBuffer;
BaseGame.Device.DrawIndexedPrimitives(
PrimitiveType.TriangleList,
0, 0, numOfVertices,
0, numOfIndices / 3);
} // RenderVertices()
is possible to
1)update the matrix
2)draw the mesh 1
3)do the transform work with the shader
4)reupdate the matrix whit a different mesh (also skinned)
5)draw the mesh n
6)redo the transform work with the shader and the changed matrix
and so one....????
how???
Thanks