Contributors: Jellejurre, JustSleightly
Avatar Masks
Unity Behaviour
A mask blocks out humanoid muscle values, material swaps and transform values from animations played in an animator controller based on what is enabled and what is disabled in the mask. If a layer has a mask with a certain value enabled in the mask, the animation is allowed to animate that value. If a layer has a mask with a certain value disabled in the mask, the animation is not allowed to animate that value.
To be specific:
- If a layer has a mask with a humanoid value (such as left hand) enabled, that humanoid muscle can be modified by an animation in that layer
- If a layer has a mask with a humanoid value (such as left hand) disabled, that humanoid muscle can't be modified by an animation in that layer
- If a layer has a mask with a transform value enabled or not specified, that transform can have its position, rotation and scale modified by an animation in that layer, as well as a material swap on the first material slot
- If a layer has a mask with a transform value disabled, that transform can't have its position, rotation or scale, or a material swap on the first material slot modified by an animation in that layer
If a layer has any mask whatsoever, it can't animate material swaps on any material slot beyond the first, or the root transform of the object with the animator on it.
Anything else (blendshapes & any other components) is unaffected by masks.
The reason we have masks is because if you animate a humanoid muscle on one layer, and then animate any humanoid muscle on a different layer that gets applied later (whether lower down in the animator or on a different playable layer), it gets overwritten (unless the other layer is an Additive layer, if so it adds on top of it). With transforms, this only happens if the second animation uses WD off and is on a Playable Layer that gets applied later. So for example if we didn’t have masks, if you animated a humanoid muscle on your Gesture Layer for hand movement, it would overwrite your Base Layer and your avatar would be in default pose (bike pose) all the time.
This means that if you have a humanoid animation, without masking just the humanoid muscles you want to be enabled, and the rest disabled, all other humanoid muscles will be overwritten.
This also means that if you have Transform animations on your Gesture layer, and you have an unmasked WD Off Transform animation on the FX layer, all the Gesture Layer Transform animations will be overwritten.
The default VRChat FX Layer uses an unmasked WD off blend tree. This can cause transform animations to not play in VRChat as long as you are using the default FX Layer. If you want to animate transforms on the Gesture layer, you have to either use your own FX Layer or remove theirs and set it to be empty.
VRChat layer behaviour
All playable layers are applied one after the other. First the Base, then Additive, then Gesture, then Action and lastly FX.
On the first four layers (Base, Additive, Gesture & Action), you should only use animations which affect transforms (so either humanoid muscles or transform animations) and toggle gameobjects on/off.
This isn't because of masking, but because these four layers are played only on your local avatar clone, but not on your mirror and shadow clones. VRChat copies the transforms and on/off state of every GameObject on your local avatar and applies them to your avatars mirror and shadow clone. However, VRChat does not copy anything other than transforms and the on/off state of each GameObject, meaning that if you were to animate anything other than that, such as blendshapes, material swaps or shader settings, VRChat will not copy those attributes to the mirror and shadow clones. The clones do however play their own FX Layer, which is why anything other than the transforms and on/off states of GameObjects should be animated in the FX Layer.
For example: if you do a material swap on the Base Layer, it won't run on the mirror & shadow clones.
This article only goes into detail when it comes to masking and behaviour. If you want more information on what VRChat does with layers or what VRChat recommends you do with them, you can check out the official documentation.
Base Layers
Base
This layer should only animate transforms (either directly or through humanoid muscles) and/or GameObject on/off states for the reasons stated above.
VRChat recommends this layer to be used for locomotion and to only animate humanoid muscles.
Additive
This layer should only animate transforms and/or GameObject on/off states for the reasons stated above.
It is blended additively, meaning that any animations don’t replace the base layer ones, but instead the values get added.
VRChat recommends this layer to be used for tweaks to locomotion, like breathing effects, and to only animate humanoid muscles.