Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've been using the skinned sample from XNA tutorials to understand and play FBX files animation. While the animation in all my tests runs correctly, I fail to understand the technic to calculate time versus keyframes.

Most of the models I found so far for free and testing purpose on google store all animations into one "take" and split frames into all animations. So, walk would be frame 1 to 14, run 15 to 30, jump 32 to 48, etc. On the other hand, the skinning sample loads all frames and store a calculated time which it will be using to loop the animation.

The part where I'm getting confused is on the keyframe part. For example a model I've been trying to load gives me a 12 seconds timespan with 20160 keyframes. While the timespan seems right, the keyframe count seems to have been altered in some way since in Milkshape and in the Autodesk converter the frame count is at 300. What is it doing?

Here's my setup for model conversion.

  1. I use Milkshape 3D to export a model and its animation to an FBX binary file.
  2. Then, I use the Autodesk file converter to convert the file into an ASCII FBX (so far I tried and tested the FBX2012 and version 6.1, which is the same as the "dude.fbx" given with the skinning sample).
  3. Processing model inside XNA with the SkinnedModelProcessor given with the skinning sample.

What I'm really trying to achieve here is to split animation into smaller clips so I can switch depending on the user action. I'm perfectly fine with counting keyframes, but as you can see, the keyframe count is way too high.

share|improve this question
You are doing something wrong in the export process, its kind of hard to tell what though since you are the one exporting. Maybe you can search online on how to export models properly with the correct keyframes? – AttackingHobo May 29 '11 at 20:22
@AttackingHobo Well, the Milkshape exporter doesn't have any options, so I don't know what I could be doing wrong. However, I've gathered a bit more information now. It seems the animation was exported at 24 FPS, so I can get a time range this way. But it's not quite right for the moment. I'm really confused :( Edit: There seem to be a bit more information here: – Allov May 29 '11 at 20:25
I have been looking online and I see that people are having lots of problems with milkshape and XNA. It seems that they can only get a model loaded, but they have to mess with it a lot settings manually in the file and it seems that animations don't get imported correctly. I would try using blender instead of milkshape. – AttackingHobo May 29 '11 at 20:37
@AttackingHobo well, it must not be the best, but as I said, in the end, the animation looks alright. It's just a matter of finding out how to split all the clips. It seems the SkinnedModelProcessor "bakes" the frames so less has to be calculated. But, it's hard to find the right way to split them up without any stutter and have a real loop. Sure, the "dude"'s animation loops correctly. But, the only animation there is in this file is the walk animation. I didn't have much luck with blender, can't find any model that I can load with the animations :( – Allov May 30 '11 at 0:15
up vote 0 down vote accepted

It's been a couple of days, and I'm still searching for a perfect solution. I did, however, find something to work with for now. My main problem was to work with time span instead of frame span. Also, I think the models I'm using aren't rigged correctly. So, I still can't get the "walk" animation to play right.

I'm using this method to split up the clips at the PROCESSING time: (see Spacedude's post in the middle of the thread).

Here's what I'm doing to test this out. SplitAnimations() is called in the Process() method after it has been processed.

Dictionary<string, AnimationClip> animationClips;
animationClips = ProcessAnimations(skeleton.Animations, bones);
animationClips = SplitAnimations(animationClips["Animation"], @"C:\defs.txt");

Then, in my component, I do this to start a clip:

    protected override void LoadContent()
        var data = Model.Tag as SkinningData;

        AnimationPlayer = new AnimationPlayer(data);

        if (!string.IsNullOrEmpty(CurrentClip) && data != null)
            var clip = data.AnimationClips[CurrentClip];

It'as all testing code for now. More to come.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.