Author Topic: Animation Blending isn't working.  (Read 4701 times)

Offline AGP

  • quad
  • ******
  • Posts: 1526
    • View Profile
Animation Blending isn't working.
« on: September 10, 2011, 12:03:28 am »
I thought OgreMax wasn't exporting my pose animations. It turns out that when I DON'T call animateSkin(), animatePose works. But if I do, all I see is the skin animation. Please help.

Offline AGP

  • quad
  • ******
  • Posts: 1526
    • View Profile
Re: Animation Blending isn't working.
« Reply #1 on: September 10, 2011, 12:14:31 am »
By the way, I should note that when I don't call animatePose(), the fps leaps from 36 to 48, so animatePose() is taking its toll on performance but it's not showing any results.

Offline raft

  • Moderator
  • quad
  • *****
  • Posts: 1972
    • View Profile
    • http://www.aptalkarga.com
Re: Animation Blending isn't working.
« Reply #2 on: September 10, 2011, 02:25:48 pm »
to enable animation blending you should switch off auto apply animation.

call once
Code: [Select]
animatedGroup.setAutoApplyAnimation(false);
then on each frame
Code: [Select]
animatedGroup.animatePose(..);
animatedGroup.animateSkin(..);
animatedGroup.applyAnimation();

Offline AGP

  • quad
  • ******
  • Posts: 1526
    • View Profile
Re: Animation Blending isn't working.
« Reply #3 on: September 11, 2011, 07:47:25 am »
Thanks, that did it. I put it up on the wiki, and it should be on the documentation.

Now here's a separate issue: I don't think the animations are being refreshed at the rate of the screen because although I'm getting just over 40 frames per second now, the animation is still REALLy choppy.

Offline raft

  • Moderator
  • quad
  • *****
  • Posts: 1972
    • View Profile
    • http://www.aptalkarga.com
Re: Animation Blending isn't working.
« Reply #4 on: September 11, 2011, 07:03:07 pm »
I don't think the animations are being refreshed at the rate of the screen because although I'm getting just over 40 frames per second now, the animation is still REALLy choppy.

I didn't understand what you mean here. Animation speed is under your control. It depends on how fast you increase animation index every frame.

Offline AGP

  • quad
  • ******
  • Posts: 1526
    • View Profile
Re: Animation Blending isn't working.
« Reply #5 on: September 11, 2011, 08:22:21 pm »
What I mean is that it seems like the animation control runs on a separate thread: at 40 frames per second, it should look a LOT smoother than it does.

Offline raft

  • Moderator
  • quad
  • *****
  • Posts: 1972
    • View Profile
    • http://www.aptalkarga.com
Re: Animation Blending isn't working.
« Reply #6 on: September 11, 2011, 08:24:06 pm »
Bones does nothing to control animation speed. It's all in application's control. It depends on how fast you increase animation index every frame.

Offline AGP

  • quad
  • ******
  • Posts: 1526
    • View Profile
Re: Animation Blending isn't working.
« Reply #7 on: September 11, 2011, 08:45:06 pm »
Does applyAnimation() hold until it's finished applying? Because I really think it should look smoother than it does if the frame rate is to be believed (I'm using Egon's simple HelloWorld counter and it looks perfectly right).

Offline raft

  • Moderator
  • quad
  • *****
  • Posts: 1972
    • View Profile
    • http://www.aptalkarga.com
Re: Animation Blending isn't working.
« Reply #8 on: September 11, 2011, 08:50:42 pm »
Does applyAnimation() hold until it's finished applying?
What do you mean?

Why don't you try decreasing animation index increment per frame?

Offline AGP

  • quad
  • ******
  • Posts: 1526
    • View Profile
Re: Animation Blending isn't working.
« Reply #9 on: September 11, 2011, 09:12:14 pm »
I did, it stays choppy and moves too slowly. Besides, I'm calculating the animation increase relative to the time passed since the last frame.

Offline raft

  • Moderator
  • quad
  • *****
  • Posts: 1972
    • View Profile
    • http://www.aptalkarga.com
Re: Animation Blending isn't working.
« Reply #10 on: September 11, 2011, 09:13:15 pm »
what do you mean exactly by "choppy" ?

Offline AGP

  • quad
  • ******
  • Posts: 1526
    • View Profile
Re: Animation Blending isn't working.
« Reply #11 on: September 11, 2011, 09:41:18 pm »
Choppy is the opposite of smooth. It looks like it's refreshing at under 10 frames per second. 40 frames per second is almost twice as much as film. One character's animation should look perfect, but it doesn't.

Offline raft

  • Moderator
  • quad
  • *****
  • Posts: 1972
    • View Profile
    • http://www.aptalkarga.com
Re: Animation Blending isn't working.
« Reply #12 on: September 11, 2011, 09:49:04 pm »
mm, but as I said, Bones does not control animation speed. It's all in application's control. try playing with speed (aniamation index increment)

Offline raft

  • Moderator
  • quad
  • *****
  • Posts: 1972
    • View Profile
    • http://www.aptalkarga.com
Re: Animation Blending isn't working.
« Reply #13 on: September 11, 2011, 09:57:24 pm »
mabe you have too few keyframes in your animation. exact position is interpolated between keyframes, so that may effect how it looks too

Offline AGP

  • quad
  • ******
  • Posts: 1526
    • View Profile
Re: Animation Blending isn't working.
« Reply #14 on: September 11, 2011, 10:19:59 pm »
Having too few frames sort of makes sense (that would mean that either OgreMax or your exporter is chopping the animation because in Max it looks perfect). But even then, the interpolation would make it look smooth (if a little odd). And decreasing the increment, as I said, slows it down but doesn't resolve the choppiness.