Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We are updating our Terms of Service for all Unity subscription plans, effective October 13, 2022, to create a more streamlined, user-friendly set of terms. Please review them here: unity.com/legal/terms-of-service.
    Dismiss Notice
  3. Have a look at our Games Focus blog post series which will show what Unity is doing for all game developers – now, next year, and in the future.
    Dismiss Notice
  4. Join us on Thursday, September 29, for a day with Unity's SRP teams here on the forum or on Reddit, and discuss topics around URP, HDRP, and the Scriptable Render Pipeline in general.
    Dismiss Notice

Additive animations not working

Discussion in 'Animation' started by silentneedle, Jul 31, 2016.

  1. silentneedle

    silentneedle

    Joined:
    Mar 14, 2013
    Posts:
    280
    Hey Guys,

    I'm currently trying to add additive animations to my character. I've two animations:

    1. Idle (Base Layer)
    2. Hold weapon (Additive layer)

    So from my understanding, as soon I set the weight of the additive layer to 1 the character should play the idle with the hold weapon animation, but instead my character still idles without holding the weapon.

    Is there any special trick to create additive animations?

    I'm using Unity 5.3.
     
  2. Kim-Nobre

    Kim-Nobre

    Joined:
    Jul 26, 2016
    Posts:
    12
    I'm not sure why exactly are you trying to use an "Additive" layer, I usually use an "Override" layer for that, have you tried it already?
     
  3. silentneedle

    silentneedle

    Joined:
    Mar 14, 2013
    Posts:
    280
    Override is working fine, but it doesn't look good when my character is running (the arms are too steady).
     
  4. Mecanim-Dev

    Mecanim-Dev

    Unity Technologies

    Joined:
    Nov 26, 2012
    Posts:
    1,675
    Hi silentneedle,

    How did you created your animation clip?

    Additive clip are kind special, if you import a clip to be used in a additive layer and doesn't setup the additive reference pose, the system will use the pose at frame 0 in your clip as the reference pose.

    There is two way to setup the additive reference pose, when you import your clip you can define a frame to be used as the reference pose
    http://docs.unity3d.com/Manual/class-AnimationClip.html
    or by script with
    http://docs.unity3d.com/ScriptReference/AnimationUtility.SetAdditiveReferencePose.html

    I guess in your case you have an animation that hold a gun that last 1 frame, so the system use the same frame as the reference frame and the animation to add, since there is no difference between frame 1 and 1 you don't see anything move
     
    siddharthlabs likes this.
  5. exerion

    exerion

    Joined:
    Jun 29, 2011
    Posts:
    54
    Hi Mecanim-Dev =D

    Why is the Additive Reference Pose Clip setting not easily accessible for clips created within Unity?

    If I hadn't found this thread I would have continued to think the additive feature in Mechanim was broken.

    For those struggling with this you can additionally set your editor to debug mode to expose the settings when you have an animation clip selected. Don't forget to set the Has Additive Reference Pose bool as well as setting the Additive Reference Pose Clip otherwise it wont work.
     
    oAzuehT, Cylau, MPV_James and 5 others like this.
  6. Dawdlebird

    Dawdlebird

    Joined:
    Apr 22, 2013
    Posts:
    78
    Trying to do exactly this; I have an animation (let's call it "happy", frames 40 to 64) that differs significantly from idle, both clips from a single asset, and have the pose frame for happy set to the first idle frame (and additive reference pose flagged on obviously).
    Unity would have to take happy and substract that idle pose to get the additive difference, right?
    And if if I then play happy as additive onto idle, I should get my full happy animation, right?

    But it doesn't; it seems to just take the first frame of happy as a reference pose, and creates an additive clip based purely on that pose (which is some minimal jitter currently) that gets added onto my idle.
    I would say the result is quite sad instead...
    Am I missing something here?
     
  7. Dawdlebird

    Dawdlebird

    Joined:
    Apr 22, 2013
    Posts:
    78
    Actually, exerions tip for using debug mode revealed the issue; regardless of what frame is set as a reference pose, the importer will make use of a 'preview' clip based on the clip used as additive animation. Any frame lookup will be done relative to this preview clip. Unfortunately, these additive reference pose clips cannot be set in the animation clips of an asset. The only way to work around this bug is to duplicate these clips to stand-alone assets, and then set the reference pose clip to an idle animation (or whatever animation is to serve as a basis). The downside here is that updating the original asset will not update these duplicate clips.
     
  8. 5argon

    5argon

    Joined:
    Jun 10, 2013
    Posts:
    1,553
    lol lose 2 hours before finding this thread. Additional clarification since this came up the top from Google, important rule :

    https://docs.unity3d.com/ScriptReference/AnimationUtility.SetAdditiveReferencePose.html

    Without entering Debug mode, if we have an additive layer with full weight, both base layer and additive layer playing single state

    Screenshot 2019-05-19 15.38.07.png

    Situation 1

    Base layer : single keyframe, looping, position x = 5
    Additive layer : single keyframe, looping, position x = 1

    Expected : constant position x = 6
    Result : constant position x = 5, because the additive layer reference the first frame of itself, which has position x = 1. When it is playing, it is always 1 - 1 = 0 so nothing got added.

    Situation 2

    Base layer : single keyframe, looping, position x = 5
    Additive layer : 2 keyframes, looping, position linearly ramp up from x = 0 to x = 1

    Result : position ramp up from x = 5 to x = 6. Additive layer use the first frame of itself as a reference like before but this time it's x = 0. Overtime we get +0 ~ +1 to the base layer correctly. You can also adjust the total addition with Additive layer's weight.

    Situation 3

    I want to upgrade the ramp, so I made the 2 keyframes that was ramping up from x = 0 to x = 1 to become x = 3 to x = 4 instead.

    Expected : position ramp up from x = 8 to x = 9
    Result : position still ramp up from x = 5 to x = 6. Again, since the additive clip use the first frame of itself as a reference, we get 3 - 3 = 0 ~ 4 -3 = 1 -> still ramping up from +0 ~ +1

    How to make the first situation producing constant x = 6, and the 3rd situation producing ramping up x = 8 to x = 9?

    Make a custom reference clip. It doesn't have to be in the graph, but you should copy from your previous clip so it has a Position keyframe. (If it is not in a graph, you cannot key a new kind of keyframe to it from "nothing", but you could delete keyframes) Make it a single keyframe with 0 0 0 position.

    Screenshot 2019-05-19 15.46.45.png

    Enter debug mode of the additive clip with a single keyframe position x = 1. Connect the zero reference clip and check has additive reference pose check box. Now x = 1 will be 1 - 0 = 1 correctly and not 1 - 1 = 0, and produce a constant x = 5 + 1 = 6 when playing additively.

    Screenshot 2019-05-19 15.47.31.png

    (imo this box should be exposed, especially that I am doing UI animation where there is a lot of single frame animation that I want them added it is not obvious that I have to enter Debug mode.)
     
    Last edited: May 19, 2019
  9. alanmthomas

    alanmthomas

    Joined:
    Sep 7, 2015
    Posts:
    197
    I agree that this should be exposed. And thank you so much for this post! I've been trying to get additive blending to work properly and couldn't until I got here. I found a lot of "use override" posts, which really don't do the trick.

    Thanks again!
     
  10. timmehhhhhhh

    timmehhhhhhh

    Joined:
    Sep 10, 2013
    Posts:
    151
    Same here - this has been an issue in the past and the solution was usually awkward. Very happy to see an updated thread and have stumbled on this ;)
     
    stoppo likes this.
  11. MallNinjaMax

    MallNinjaMax

    Joined:
    Apr 17, 2017
    Posts:
    23
    Hard to believe they couldn't fathom that people would import/create pose clips for additive poses. Not hard to believe that they would neglect fixing it for this long. I hope people are happy with their Machine Learning and DOTS toys, because the tools are rotting.

    Thanks for the workaround.
     
  12. Discmage

    Discmage

    Joined:
    Aug 11, 2014
    Posts:
    51
    Sorry to bring this up again, but it ties into this and others may have the same thought/issue...

    What happens if my animation on an additive layer is a loop that doesn't 'overlap' the reference animation position/animation? If I 'NEED' an additive reference pose frame (say, frame one) but my character needs to be positioned away from the position of the base animation and is a loop...how do I create a reference pose for a loop without having a single frame look like it's glitching because I HAVE to have a reference frame so it knows what to blend from?

    I hope that makes sense?
     
  13. Biscuitlid

    Biscuitlid

    Joined:
    Apr 1, 2013
    Posts:
    6
    I know this is very late but to do this I:

    1. Set the anim's reference pose frame in it's import settings (for my looping pose)
    2. Duplicated the looping pose
    3. Went into debug mode with the duplicated anim selected like in the above example
    4. Chucked my idle animation in as the 'Additive Reference Pose Clip'
    5. Put my duplicated anim into my animation controller
    And it was job done.

    It's an absolutely garbage process though, and it's embarrassing to see that it's been like this for half a decade!
     
  14. Lesnikus5

    Lesnikus5

    Joined:
    May 20, 2016
    Posts:
    131
    How do you edit the clip? I enter debug mode but all fields are locked!

    1.jpg
     
    PasVol likes this.
  15. Dawdlebird

    Dawdlebird

    Joined:
    Apr 22, 2013
    Posts:
    78
    Yeah that's the annoying part: you have to make a copy of the clip (ctrl+D), so it becomes a stand-alone asset. Only then can you assign it a reference pose clip.
     
  16. bearcoree

    bearcoree

    Joined:
    Mar 8, 2016
    Posts:
    58
    Is this still the way to do additive layer animations in 2022? Having to go into the debug inspector is so clunky.
     
unityunity