Search Unity

Understanding layer priority and weights

Discussion in 'Animation' started by akshay_shah, Apr 20, 2018.

  1. akshay_shah

    akshay_shah

    Joined:
    May 19, 2017
    Posts:
    16
    If say I have multiple layers in my animatorController:
    head, upperBody (everything above waist), lowerBody(everything below waist) and fullBody

    I want to achieve sometimes playing animations in fullBody layer and sometimes only the upperBody animations. It appeared that upperBody animations are not played when fullBody layer is added to controller.

    I read about setting weights to determine priority and in some other post had also read that the index of layer in the sequence also affects the priority. I am confused about the rules to determine the priority.

    Can someone please elaborate on the same?

    Thanks!
     
  2. petey

    petey

    Joined:
    May 20, 2009
    Posts:
    1,824
    Hey @akshay_shah have you used Avatar Masks? https://unity3d.com/learn/tutorials/topics/animation/avatar-masks
    They control which parts will override underlying animations If no mask is set, the layer will completely override (unless you have the blending set to additive and then it will add to the transforms).

    Definitely mess around with those two things and you'll start to see.

    As for priority, here "Actions" would override "Base", but you can see the weight is set to zero (from the line under the name).
     
    xjjon and theANMATOR2b like this.
  3. akshay_shah

    akshay_shah

    Joined:
    May 19, 2017
    Posts:
    16
    Yes, I am aware of the masks.
    I do have masks set for head, upperBody and lowerBody.

    So with Base.weight = 1 and Actions.weight = 0, actions has higher priority because action is at higher layer than Base.
    If that is true, will the result be same if both Base and Actions had weight=1?

    Also can you please provide an example where updating weights is helpful? I am not able to understand under what scenarios is it good to update weights? I know, it would be case by case basis, but an example would provide me with an idea of when to play with the weights?
     
  4. petey

    petey

    Joined:
    May 20, 2009
    Posts:
    1,824
    No, Actions will always have a higher priority but it wont be visible until the layer weight is turned up.

    One example where this might be handy could be if you had a breathing animation on an additive layer, you could blend that in and out to add an effect to the underlying animation.
     
  5. akshay_shah

    akshay_shah

    Joined:
    May 19, 2017
    Posts:
    16
    Cool..
    So to summarise for anyone visiting this thread, (by priority below I mean, net effect will be visible of)

    Priority 1 -> Higher Layer with Higher weight
    Priority 2 -> Lower Layer with Higher weight
    Priority 3 -> Higher Layer with Lower weight
    Priority 4 -> Lower Layer with Lower weight

    The discussion helped.. Thanks!
     
  6. zhaozony

    zhaozony

    Joined:
    Jan 7, 2020
    Posts:
    29
    I dont think your conclusion is right. The result is not a chart as you listed.
    Layer order is a discrete thing. either bigger or smaller.
    But weight is the factor that it blends with others, which is continual.
     
    Genebris likes this.
  7. TheLivingCat01

    TheLivingCat01

    Joined:
    Jun 8, 2022
    Posts:
    1
    Alright let’s assume that the weight is set to 1 on all layers and it’s on override. If I understand this correctly, the layer that is lower on the list will have higher priority than the ones above it so it will override them, is that correct?
     
  8. Genebris

    Genebris

    Joined:
    Mar 18, 2013
    Posts:
    144
    It's hilarious and sad that neither documentation nor UI tells you which layer is actually on top. I get confused by this every time. Yes, bottom layer overrides top layer.