1
\$\begingroup\$

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.

\$\endgroup\$
4
  • \$\begingroup\$ 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? \$\endgroup\$ May 29, 2011 at 20:22
  • \$\begingroup\$ @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: forums.create.msdn.com/forums/p/65573/401185.aspx \$\endgroup\$
    – Allov
    May 29, 2011 at 20:25
  • \$\begingroup\$ 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. \$\endgroup\$ May 29, 2011 at 20:37
  • \$\begingroup\$ @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 :( \$\endgroup\$
    – Allov
    May 30, 2011 at 0:15

1 Answer 1

0
\$\begingroup\$

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: http://forums.create.msdn.com/forums/t/1415.aspx?PageIndex=2 (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()
    {
        base.LoadContent();
        var data = Model.Tag as SkinningData;

        AnimationPlayer = new AnimationPlayer(data);

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

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

\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .