It actually quite simple. All you need to do is use float4x3 instead of float4x4 in shader. You don't need to change anything on C# code side at all (Of cause except MaxBone constant value). Effect class takes care of converting Matrix array to float4x3 array for you!!
If you are using our SkinningSample code, you only need to modify 3 locations in SkinnedModel.fx and change MaxBones value to 79 from 59. The following code is original code ( "// ..." means there is other codes ):
| float4x4 Bones[MaxBones]; |
| |
| //... |
| |
| VS_OUTPUT VertexShader(VS_INPUT input) |
| { |
| // ... |
| |
| // Blend between the weighted bone matrices. |
| float4x4 skinTransform = 0; |
| |
| //... |
| |
| // Skin the vertex position. |
| float4 position = mul(input.Position,skinTransform); |
| |
You have to change those lines like below (changed part are under lined):
| float4x3 Bones[MaxBones]; |
| |
| //... |
| |
| VS_OUTPUT VertexShader(VS_INPUT input) |
| { |
| // ... |
| |
| // Blend between the weighted bone matrices. |
| float4x3 skinTransform = 0; |
| |
| //... |
| |
| // Skin the vertex position. |
| float4 position = float4( mul(input.Position,skinTransform), 1 ); |
| |