I'm sure everyone is tired of my questions, but I have one more before I can really get to work on my project. For those of you who don't know, I am creating a basic XNA recreation of Minecraft. My current problem is that my "Steve" model, which is skinned with an armature using vertex groups to deform, is showing up disfigured beyond all reason. I am using a custom shader with skinning imported from the SkinnedEffect from the StockEffects example. I'm sure the effect itself works fine and that my model's groups and weights are the problem. But, to be sure, I will post both.
Pictures:
My Custom Shader:
//VertexShader
VertexShaderOutput VertexShaderFunction(VertexShaderInput input)
{
VertexShaderOutput output;
Skin(input, NumBones);
float4x4 worldViewProj = mul(mul(World, View), Projection);
output.Position = mul(input.Position, worldViewProj);
float4 normal = mul(input.Normal, WorldInverseTranspose);
float lightIntensity = dot(normal, DiffuseLightDirection);
output.Color = saturate(DiffuseColor * DiffuseIntensity * lightIntensity);
output.Color.a = 1;
output.TextureCoordinate = input.TextureCoordinate;
return output;
}
//Skin() Method
void Skin(inout VertexShaderInput input, uniform int boneCount)
{
float4x4 skinning = 0;
[unroll]
for (int i = 0; i < boneCount; i++)
{
skinning += Bones[input.Indices] * input.Weights;
}
input.Position = mul(input.Position, skinning);
}
And my Steve model is here in .blend format. The version of Blender I use is 2.6. Pay no attention to the corner-looking piece. That's just there for size comparison when I built him. I export to .fbx with only the mesh and armature selected. No options are selected other than "Export Selected" and "Apply Modifiers". Smoothing is off, Forward is -Z Forward and Up is Y Up. Again, I think the problem is the vertex groups and wights. Everything deforms properly in Blender, but not in XNA.