XNA Creators Club Online
Page 1 of 1 (14 items)
Sort Posts: Previous Next

Help with Skinning sample, model plays too fast

Last post 07-30-2008 7:02 AM by leoo. 13 replies.
  • 03-18-2007 1:56 AM

    Help with Skinning sample, model plays too fast

    Hi, I ran the sample fine, but when trying with one of my models the animation plays too fast.

    I tried many things, I changed the Update function on SkinningSample.cs (commented a line and added the one below). The animation slowed but not enough, and I really don't want to change the animation being relative to ElapsedGameTime.

    //animationPlayer.Update(gameTime.ElapsedGameTime, true, Matrix.Identity);

    animationPlayer.Update(System.TimeSpan.FromMilliseconds(1), true, Matrix.Identity);

    animationPlayer.Update(System.TimeSpan.FromMilliseconds(1), true, Matrix.Identity);

    Which is the the best way to alter the sample in order to have the animation played at correct speed?. I would like to specify the frames and the time that it takes between frames.

    My model has the following animation list in frames

    000 - 030 walk
    040 - 080 run
    100 - 150 jump
    160 - 300 idle
    310 - 340 strafe left
    350 - 380 strafe right
    400 - 440 jump 360
    440 - 500 run2
    510 - 539 dog run
    550 - 620 kick-01
    620 - 680 attack-01
    680 - 740 kick-02
    800 - 850 attack-02
    850 - 880 hit react
    900 - 980 backflip
    1000-1085 death-01
    1100-1195 death-02
    1200-1300 flip
    1305 pose1
    1306 pose2
    1307 pose3
    1308 pose4
    1311 pose5
    1312 pose6

     

    But the skinningData.AnimationClips array detects only one animation called "Anim-1" with 54.043 keyframes in only 0.25 seconds; obviously the reason the model plays so fast.

     Thanks in advance

  • 03-19-2007 1:28 PM In reply to

    Re: Help with Skinning sample, model plays too fast

    Does this animation play correctly in the DirectX mesh viewer?

     

    XNA Framework Developer - blog - homepage
  • 03-19-2007 6:07 PM In reply to

    Re: Help with Skinning sample, model plays too fast

    This is an asset that I adquired from www.3drt.com, so I have not used it before. I was unable to test it in the mesh viewer by the time I posted because the February 2007 version was not showing it. I reverted to Octuber 2006 version of the SDK and was able to open the mesh, but as you suspected, the animation played at ultra fast speed, just as it played on the Skinning Sample.

    Can I correct this behaviour by altering some of the classes in the sample? I would like to expand the class functionality to specify the start and end frame of the animation to be played, for this and other models that I have. (The other models plays fine). I would also like to be able to override the default speed of the animation.

    What classes do you suggest I should alter in order to gain this functionality?

    Many thanks in advance

  • 03-19-2007 6:40 PM In reply to

    Re: Help with Skinning sample, model plays too fast

    The skinning sample takes in the time offset as a parameter to AnimationPlayer.Update, so you could easily scale that value to make it play at a different speed.

    You might also look at editing the .X file to change the animation framerate. 

    XNA Framework Developer - blog - homepage
  • 03-20-2007 9:10 PM In reply to

    Re: Help with Skinning sample, model plays too fast

    Thanks Shawn, but still no luck. Actually changin the AnimationPlayer.Update parameter was my first try, but even with the hardcoded value of 1 the animation played too fast. I even tried less than 1 values, but with less than .5 the animation does not play at all.

    I asked the artist but they don't know anything about programming. At least they game permission to put a link to a free animated mesh, This mesh has the exact same behaviour that the one I am trying to use.

    http://www.3drt.com/3dm/free/3drt.com-free-monster-animated-character.zip

    Feel free to download it, if anyone make it work, please let me know how. Remember to visit the artist web site to check for the license agreement. www.3drt.com

     

  • 03-20-2007 9:24 PM In reply to

    Re: Help with Skinning sample, model plays too fast

    Baltico,

     I was having issues with the free models from Psionic animating too fast.  So, when I added some code to slow things down in the animation player the animation got choppy.

    Eventually, I started exporting from fragmotion and the animation runs smoothly and at a good speed.  I had some major issues with the .x exporter in Milkshape and Fragmotion, but things are working fine and dandy now.

    So, see if you can open the model in fragmotion and then export it setting the framerate to 60.

    - Matt D

  • 03-20-2007 11:45 PM In reply to

    Re: Help with Skinning sample, model plays too fast

    Matt, I am almost there, Fragmotion fixed the animation problem, and now it plays perfect on the DirectX Viewer.

    When compiling the SkinningSample I got an error telling me that the mesh has two skeletons,

    Error 3 Node has more than one BoneContent child. Unable to determine which one is the skeleton root.

    So I had to delete one of the root bones OR create a new bone and make the ohters children of this new one. In any case I was able to compile and run the sample, but with the following problem:

    When I use the exported model on the Skinning Sample, the model looks strange, the animation plays good, but the model looks like culling is inverted, but I am not shure, maybe is just a transformation problem. I don't know if it has something to do with the root bone because it still plays good on the DirectX Viewer.

    I am almost there, any ohter suggestions? 

  • 03-21-2007 9:14 AM In reply to

    Re: Help with Skinning sample, model plays too fast

    Baltico,

    I remember getting the two skeleton error and forgot if I had discarded that test model or worked with it.  I have about 60 different versions of the same model just to solve this problem through trial and error.  :)

    But, you are in luck...Maybe.  After hours of pain and agony I figured out why the meshes play well in the DirectX viewer but not in the skinning sample.  When compiling your game, see if there is a warning about a mesh being a child of a bone.  If that is the case, double click on the mesh in solution explorer to open it in game studio express.  Then, you'll notice the .X file structure is a lot like a mix of xml and c#.  Structures are nested like xml, but the nesting is done with curly brackets like C#.  Now, do a search and look for structures named "Frame".  Now, nested inside of that structure/s is the "Mesh" structure and some more structures related to the mesh.  Cut and Paste all of the Mesh information outside of the Frame structure and before the "AnimationSet" structure.  The difficutly of this process is dependent on the number of meshes you have so if it is not working right away start with a small test model with a few bones and one mesh to get a feel for how the .x file structure is.

    -Matt D

  • 03-21-2007 7:22 PM In reply to

    Re: Help with Skinning sample, model plays too fast

    Wow, I don't know how you figured dit out but it worked.

    What I did was the following:

    1) Open original .X file in fragMOTION

    2) Exported to .X without any changes using Text as Format, Matrix Keys and Hierarchical Mesh options checked, 60 frames per second. Did not deleted or moved any of the two root bones, see below.

    3) Added the asset to the content folder, changed Model Processor property to SkinnedModelProcessor

    3) Manually edited the .X file in Game Studio EXpress (do not attempt it in notepad) and extracted the complete Mesh hierarchy out of one of the root bones tagged as Frame. Then deleted the extra root bone. Example:

    Frame A {
      FrameTransformMatrix {
       1.000000,0.000000,0.000000,0.000000,0.000000,1.000000,0.000000,0.000000,0.000000,0.000000,1.000000,0.000000,0.000000,0.000000,0.000000,1.000000;;
      }

      Mesh {
      ....
      ....
      }
    }

    Frame B {
     Frame C {}
    ...
    }

    AnimationSet Anim-1 {}

    --- Was changed for this ---

    Frame B {
     Frame C {}
    ...
    }

    Mesh {
      ....
      ....
    }

    AnimationSet Anim-1 {}

     

     

  • 03-21-2007 8:42 PM In reply to

    Re: Help with Skinning sample, model plays too fast

    You got it!!!

     Now, all I have to do is figure out how to blend multiple animations together.  I think I found a bug or something because variable assignments in the AnimationPlayer.cs are getting out of whack.

     

    - Matt D

  • 03-21-2007 10:37 PM In reply to

    Re: Help with Skinning sample, model plays too fast

    Answer

    Jejeje, you are not going to beleive it. Comparing the original .X file and the one that I got at the end, I noticed that the following sections was missing in the original file

    AnimTicksPerSecond {

    60;

    }

     

    Jaja, I just added that section to the original .X file and the animation played at normal speed. Actually I changed the value to 30 instead of 60 to slow it down a little more.

    Matt, Shawn, Thanks very much for all the help, I learned a lot.

  • 08-23-2007 6:34 PM In reply to

    Re: Help with Skinning sample, model plays too fast

    I am having trouble getting this model to work right. Baltico X, is there any way I can contact you and get a working version of this model?
  • 08-23-2007 11:35 PM In reply to