FBX model animation glitches with XNA importer

Started by
4 comments, last by Tengato 10 years, 6 months ago

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:

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!

Advertisement

which models is it, the 3drt ones? I had a few issues at first (mainly animation speed, but I think also some odd behaviour like you're seeing).

this is my current code if it helps :

https://code.google.com/p/xexuxjy-xna-games/source/browse/trunk/Gladius/Gladius/renderer/animation/AnimatedModel.cs

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

I restore Nintendo 64 video-game OST’s into HD! https://www.youtube.com/channel/UCCtX_wedtZ5BoyQBXEhnVZw/playlists?view=1&sort=lad&flow=grid

I did suspect the weights for a bit, but I checked out the vertex buffer contents and with 4 weights, the values are normalized. The rest of my code assumes 4 weights.

This is where I got the model, by the way:

http://www.dexsoft-games.com/models/futuristic_soldier.html

I can’t open or run the sample so humor me.

How do you extract vertices from the FBX file? And how do you attach bones and weights to them?

L. Spiro

I restore Nintendo 64 video-game OST’s into HD! https://www.youtube.com/channel/UCCtX_wedtZ5BoyQBXEhnVZw/playlists?view=1&sort=lad&flow=grid

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.

This topic is closed to new replies.

Advertisement