Search Unity

Additive Reference Pose

Discussion in 'Animation' started by zberwaldt, Nov 30, 2016.

  1. zberwaldt

    zberwaldt

    Joined:
    May 20, 2013
    Posts:
    2
    Hello,

    I have seen the additive reference pose option on my clips for some time now, but I can't find any examples of it or in depth explanations of what it is and how to use it. Can anyone please provide an example or point me to one? it would be greatly appreciated.

    Thanks for your time,
     
  2. Mecanim-Dev

    Mecanim-Dev

    Joined:
    Nov 26, 2012
    Posts:
    1,675
    This is for additive layer in an animator controller only

    When enabled, allows you to define the reference pose used as the base for the additive animation. Also, a blue marker becomes visible in the Start/End timeline editor: . You can specify the reference pose by entering a frame number in the “Pose Frame” field, or by dragging the blue marker in the timeline.

    Before this option came in the frame 0 was taken as the reference pose, it wasn't flexible enough to cover all the user case for additive layer because the reference pose had to be in the animation clip to make it work.

    Now with this option you create a one frame additive animation,

    take a look a this package it should work in 5.4 and 5.5
    open up aimscene press play and move the mouse cursor over the game view to see the player react.

    To make it work we did use only 4 additive aim animation clip: aim up, aim down, aim left and aim right
     

    Attached Files:

    AlexTheOutsider likes this.
  3. Helvete

    Helvete

    Joined:
    Dec 4, 2014
    Posts:
    7
    Hello Mecanim-Dev! Your example is great. Is it possible to use your animations in my projects? What kind of license do they have?
     
  4. Mecanim-Dev

    Mecanim-Dev

    Joined:
    Nov 26, 2012
    Posts:
    1,675
    yes you can used them, It was extracted from one of the free unity demo package found on the asset store
     
  5. Helvete

    Helvete

    Joined:
    Dec 4, 2014
    Posts:
    7
    Many thanks )
     
  6. Reanimate_L

    Reanimate_L

    Joined:
    Oct 10, 2009
    Posts:
    2,788
    you guys really need to create a documentation with this kind of example.
     
  7. Mecanim-Dev

    Mecanim-Dev

    Joined:
    Nov 26, 2012
    Posts:
    1,675
    I will try to figure a way to integrate it in the doc, thx for the feeback
     
  8. WendelinReich

    WendelinReich

    Joined:
    Dec 22, 2011
    Posts:
    228
    That would be great, especially because the package you attached above actually doesnt use/specify a reference pose anywhere (I just checked). I'm still puzzled about how it's used:
    - Each clip has it's own reference frame right? And they cant be shared across clips?
    - Once defined in the importer, is the reference frame stripped from the actual clip?

    Thanks!
     
    Brad-Newman likes this.
  9. WendelinReich

    WendelinReich

    Joined:
    Dec 22, 2011
    Posts:
    228
    OK I figured out the answer to my second question: the frame isn't stripped automatically, but if it's the first or the last frame of the clip it can (and must) be excluded by setting Start and End frames in the importer accordingly. That works for me, I'll just create all my additive animations with a reference frame placed at the beginning.
     
  10. oantsmap

    oantsmap

    Joined:
    Aug 19, 2012
    Posts:
    7
    @Mecanim-Dev Is it possible to set an additive reference clip for animations imported from fbx? I've tried everything I can think of today. There is no reference clip field to set in the clip import settings (like on standalone .anim files with the debug inspector). When I try to use the AnimationUtility.SetAdditiveReferencePose api I sometimes I get errors like "assertion failed on expression: 'MecanimDataWasBuilt()'" and "AnimationClip is not a valid reference clip". I am able to use this api in play mode and it works for the duration of the unity editor session but those changes don't seem to be serialized so when I reopen unity the additive animations no longer work.

    I'm using 5.6.5p1.
     
  11. exerion

    exerion

    Joined:
    Jun 29, 2011
    Posts:
    54
    @oantsmap I am also trying to use AnimationUtility.SetAdditiveReferencePose and I'm getting the same error. Would love to know why? Has anyone used it successfully?
     
  12. Pomb

    Pomb

    Joined:
    Aug 15, 2012
    Posts:
    2
    @oantsmap I've had issues figuring it out myself, but think I got something working.
    In the fbx animation that you want to be additive you need to bake in a key frame outside the range of the action. eg.
    spineBendBackwards.fbx , animation is 10 frames long. set frame range to start and end from 1-10 then for the additive reference pose, set that to something like frame 20 which would be a frame of the default pose.
    I used this in conjunction with the transform masks to make sure the additive animation only works on the spine.
     
  13. exerion

    exerion

    Joined:
    Jun 29, 2011
    Posts:
    54
    After some more investigation the problem was one of the animation clips that I was trying to set the AdditiveReferencePose of was animating the scale and my AdditiveReferencePose clip wasn't defining the reference pose for scale.

    @Mecanim-Dev it would be great if the error that you get in situation was more descriptive. Maybe something like...
    AnimationClip 'ReferencePose' is not a valid additive reference clip because it does not define a reference pose for all animated transforms.

    I'll also point out that if you put your editor into debug mode and assign the AdditiveReferencePose you never get the error which adds to the confusion.