ultimate unwrap 3d header
Home    Features    Buy Now    Downloads    Tutorials    Links    Support  

QuickTip for Importing FBX models into XNA Game Studio

This quicktip will explain how to successfully import animated FBX models into XNA Game Studio using Ultimate Unwrap 3D. This article assumes you are somewhat familiar with how the XNA Framework Content Pipeline works.

The Skinned Model Sample

First, download the XNA skinned model sample. It can be found here:

We will be using dude.fbx from the XNA skinned model sample to test our FBX pipeline.

Now, import dude.fbx into Ultimate Unwrap 3D. Ensure that animation plays well and everything looks correct. From the main menu, click Animation | Editor and notice that there is exactly one animation called "Take 001". Then export it back to FBX format using the default exporter settings.

qt_xna1.png qt_xna2.png

Fixing Multiple Roots

If you recompile the skinned model project, you may receive the following warnings or errors:
warning : Multiple skeletons were found in the file.
warning : Fragment identifier "him".
error : Node has more than one BoneContent child.
To fix this error, simply delete the empty root bone called him. To prevent similar problems, always ensure that your model has a single root bone before exporting to FBX.


Fixing Animation Clip Names

Now, after running SkinningSample.exe, the program may crash in SkinningSample.cs at this line:
AnimationClip clip = skinningData.AnimationClips["Take 001"];
This is because the animation name "Take 001" doesn't exist. Why is that? Well, because the FBX exporter renamed our animation to "Take_001" (note the underscore). By default, the exporter will replace all potentially unsafe characters, including spaces, with an underscore.

Now, keep in mind that this is just a demo with minimal error checking. However, we can prevent unexpected crashes by adding a line, such as:
if (!skinningData.AnimationClips.ContainsKey("Take 001")) {
   ... do something if doesn't exist
But, for our purposes, let's change the line to:
AnimationClip clip = skinningData.AnimationClips["Take_001"];
and recompile our project. Now, our FBX model should load successfully:


As a final note, whenever you make changes to your content files, such as textures or FBX files, it is important to rebuild them by recompiling the project. This is because all content is compiled into .XNB files. If you don't rebuild your content, then you won't see any changes.

That's it! If you have any other questions about FBX models or XNA Game Studio, please let us know.

Legal & Privacy Copyright © 2018. All Rights Reserved.
All trademarks and trade names are the property of their respective owners.
Follow Us On RSS Subscribe to Unwrap 3D RSS