what I can and can't do with animationStates? Implementation of animation tree

A place for users of OGRE to discuss ideas and experiences of utilitising OGRE in their games / demos / applications.
slapin
Bronze Sponsor
Bronze Sponsor
Posts: 250
Joined: Fri May 23, 2025 5:04 pm
x 16

what I can and can't do with animationStates? Implementation of animation tree

Post by slapin »

Hi, all!
I currently try to implement my own simple animation blend tree and have a question.
For the tree structure like this:

Code: Select all

as.builder()
.output()
  .statemachine()
    .state('locomotion")
      .blend2("idle-move")
        .animation('idle")
        .blend2("walk-run")
          .animation("walk")
          .animation("run")
        .end() // walk-run
      .end() // idle-move
    .end() // locomotion
    .state("swimming")
      .blend2("idle-swim"
        .animation("swim-idle")
        .animation("swim")
      .end() // idle-swim
    .end() // swimming
  .end() // statemachine
.end() // everything
.build(); // actually create objects

It works fine until I want to fade between states which have same animations (i.e. I add add(0.1).animation('idle').animation("random").end() instead of idle)
and add(0.1).animation('idle').animation("random").end() instead of swim-idle) I can't properly calculate blend weights for cross-blend between 2 states.
I know people did that in Ogre in the past as there were animation trees implemented in the past, but I got no idea how this could be implemented.
Any ideas?

User avatar
sercero
Bronze Sponsor
Bronze Sponsor
Posts: 535
Joined: Sun Jan 18, 2015 4:20 pm
Location: Buenos Aires, Argentina
x 198

Re: what I can and can't do with animationStates? Implementation of animation tree

Post by sercero »

Have you seen this?

  • Animation blendmask not working correctly

You need to use ANIMBLEND_CUMULATIVE if you want to make use of blendmasks.
http://www.ogre3d.org/forums/viewtopic.php?t=76118

slapin
Bronze Sponsor
Bronze Sponsor
Posts: 250
Joined: Fri May 23, 2025 5:04 pm
x 16

Re: what I can and can't do with animationStates? Implementation of animation tree

Post by slapin »

Yeah, I use ANIMBLEND_CUMULATIVE.

slapin
Bronze Sponsor
Bronze Sponsor
Posts: 250
Joined: Fri May 23, 2025 5:04 pm
x 16

Re: what I can and can't do with animationStates? Implementation of animation tree

Post by slapin »

if I hard-switch state without fading in/out there is no problem. If states are totally different (no same animations between states),
there is no problem fading. Looks like I need to somehow specially handle case where states have the same animation otherwise the blend amount is calculated incorrectly. I think either it should be possible to duplicate animation states for that case or it is impossible to do. But logic tells me that as I flatten the tree, I get a set of states with blend amounts and cross-fade between them it should work, but I could not find any implementation doing this.

slapin
Bronze Sponsor
Bronze Sponsor
Posts: 250
Joined: Fri May 23, 2025 5:04 pm
x 16

Re: what I can and can't do with animationStates? Implementation of animation tree

Post by slapin »

I think I could use duplicate animations but that sounds a bit crazy... also no similar implementations have problems like this...
If animation system supported additive animations that would avoid problems like that, but that's what we have...