Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

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. A link to another forum with the same question is here, since I cant post pictures or more than two links.

Here are some details about my model: 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.

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[i]] * input.Weights[i];
        }
        input.Position = mul(input.Position, skinning);
}
share|improve this question

put on hold as off-topic by Josh Petrie Dec 22 at 19:44

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions about debugging a problem in your project must present a concise selection of code and context so as to allow a reader to diagnose the issue without needing to read all of your code or to engage in extensive back-and-forth dialog. For more information, see this meta thread." – Josh Petrie
If this question can be reworded to fit the rules in the help center, please edit the question.

Browse other questions tagged or ask your own question.