Animation Aspect

From Qt Wiki
Jump to navigation Jump to search

Animation Aspect

Goals: Support as much animation computation in the backend as is reasonable

  • Frontend
    • Configuration and control of animation clips
    • Animation Action State Machine (ASM) - see Level 3 below
  • Backend
    • Number crunching (keyframe interpolation) - see Level 1 below
    • Animation blend tree evaluation - see level 2 below

Issues

  • There is a problem with QTransform(and perhaps some others)
    • The animated scale, rotation, translation must be sent back from backend to frontend every frame wasting time and effort
      • Many times the values are not needed in the frontend
    • Solution 1, don’t animate transform or any other property, which is mirrored in frontend
      • - Not flexible at all, no reflection from animations to the user
    • Solution 2, take the hit, efficiency is the same as animating in frontend(minus optimized interpolation)
      • - Complex animations cause unnececcary work.
      • + Animation fully reflected to the user
    • Solution 3, optimize frontend-backend communication
      • ???
    • Solution 4, make such property's updates from the backend to frontend opt-in.
      • Only send property notifications when animations start/end by default
      • Add support to QNode for frontend to opt-in to property updates issued by the backend

Animation Framework Levels:

The following needs to be supported by any decent animation system these days:

  • Level 1: F-curve evaluation
  • Level 2: Animation Blend Trees
  • Level 3: Action State Machine + Animator component

Level 1 is pretty much what you would expect to find in an older animation system and maps well to what Antti has developed on gerrit. However, as good as this is it leaves a lot of work in the hands of the user. This is where Levels 2 and 3 come in.

Level 2 allows the user to specify blend trees for combining several animation clips together. Classic example is blending the clip for a walk cycle with the clip for a run cycle where the blend factor is controlled by a binding to the characters speed. The blend tree forms an AST that is evaluated by the animation aspect backend after the data form level 1 is evaluated.

Level 3 provides high-level control over the animations and switching between them. This takes the form of the Action State Machine. Each state in the SM contains the root of a blend tree from level 2. When that state is active, the corresponding blend tree gets evaluated by the backend. When transitioning from one state to another, the backend can evaluate the transition by using an additional lerp node at the root of a blend tree where the children are the blend trees of the source and destination states respectively.