Sign in to follow this  
Tengato

FBX model animation glitches with XNA importer

Recommended Posts

Tengato    167

Hi, a while ago I purchased an animated model from a game content website to use in my XNA projects.  Unfortunately, there are some problems with the model's animations where the bone transforms that XNA's FBX importer produces from the model file seem to be corrupt.  The model animates fine when opened with 3ds Max and the Autodesk FBX Converter, and I have other FBX models that animate correctly when imported into XNA, so I'm wondering if this file might have some uncommon configuration or compression enabled that makes it incompatible with XNA's importer?  Or maybe someone recognizes a common mistake, like the inverse bind pose getting applied twice or something?

 

Here's a video of the animation problems:

 

http://youtu.be/ListZxWfjgw

 

The XNA animation code is pretty much straight from the animation sample:

http://xbox.create.msdn.com/en-US/education/catalog/sample/skinned_model

 

Thanks for any advice!

Share this post


Link to post
Share on other sites
L. Spiro    25621

If you wrote the animation code, be it the shaders or the CPU-side updating of bones, ensure that you have connected bones properly to their respective vertices and that you are handling as many weights as the model requires per-vertex.

If the model has more weights on a vertex than it can handle in your system, throw a warning so that next time the error will be obvious.

If you need to have a hard limit (4 is common), ensure that the vertices have no more than 4 weights on them by only using the heaviest 4 and renormalizing them.

 

 

L. Spiro

Share this post


Link to post
Share on other sites
Tengato    167

In XNA, for FBX format, model files are processed by a black-box XNA importer component which creates the meshes, the vertices and all their channels, including bone influences, weights, etc.  The importer may place a limit on the number of weights during that step, but I don't know for sure.  Next there is a more open processing step that defines the bone indices and sets up the bind and inverse bind poses. I believe it also conditions the vertex's weight channels into the correct memory size here.  After that, having no information in the resulting model object about the vertex weights, you are still responsible for making sure the effect files get weight parameter values that will work.  This mostly amounts to having knowledge about the creation of the model or simply trying out the values 1, 2, and 4.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this