虚拟形象遮罩
原始页面:https://notes.sleightly.dev/animator-masks/
Unity Behaviour行为
遮罩会根据其中人体部位的开关情况,屏蔽对应位置的人形肌肉值、材质切换和场景对象(Transform)功能。如果某一层有一个遮罩,且该遮罩的某个部位被启用,那么动画就可以对该值进行动画处理。如果某一层有一个遮罩,且该遮罩的某个部位被禁用,那么动画就不能对该值进行动画处理。具体来说:Avatar Mask 会基于在遮罩中启用和禁用的选项,阻止或允许 Humanoid Muscle 数值、材质球替换和 Transform 的动画处理。如果一个动画层具有一个启用了特定值的 Avatar Mask,那么该层的动画可以对该值进行动画处理。如果一个动画层具有一个禁用了特定值的 Avatar Mask,那么该层的动画则不能对该值进行动画处理。具体而言:
如果某一层有一个遮罩,且该遮罩的如果一个动画层具有启用了humanoidHumanoid值(如左手)被启用,那么该人形肌肉就可以被该层动画修改。Muscle 数值(例如左手)的 Avatar Mask,那么该层中的动画可以修改该 Humanoid Muscle 数值。如果某一层有一个遮罩,且该遮罩的如果一个动画层具有禁用了humanoidHumanoid值(如左手)被禁用,那么该人形肌肉就不能被该层动画修改。Muscle 数值(例如左手)的 Avatar Mask,那么该层中的动画不能修改该 Humanoid Muscle 数值。如果某一层有一个遮罩,且该遮罩的变换值被启用或未指定,那么该变换的位置、旋转和缩放就可以被该层动画修改,同时还可以修改第一个材质槽的材质交换。如果一个动画层具有启用了或未指定的 Transform 的 Avatar Mask,那么该 Transform 可以通过该层的动画修改其位置、旋转和缩放,以及对第一个材质球进行替换。如果某一层有一个遮罩,且该遮罩的变换值被禁用,那么该变换的位置、果一个动画层具有禁用了 Transform 的 Avatar Mask,那么该 Transform 的位置、旋转或缩放,或者第一个材质槽的材质交换就不能被该层动画修改。以及第一个材质球的替换,都不能通过该层的动画进行修改。- 如果一个动画层有任何 Avatar Mask,它不能对任何材质球的替换(除了第一个材质球)或 Animator 上的根 Transform 进行动画处理。
如果某一层有任何遮罩,那么除第一个材质槽外,它不能对任何材质槽进行材质切换动画,或者对带有动画器的场景对象进行动画。其他内容(如 blendshapes 和任何其他组件)不会受到 Avatar Mask 的影响。
任何其他内容(形态键(Blendshapes)和任何其他组件)都不受遮罩影响。
我们之所以使用遮罩,是因为如果你在一个图层上为一个人形肌肉制作动画,然后在另一个图层上为另一个人形肌肉制作动画(无论是更低层的动画器还是另一个可播放图层)Avatar Mask 的原因在于,如果你在一个层中对一个 Humanoid Muscle 数值进行动画处理,然后在另一个层中对同一个 Humanoid Muscle 数值进行动画处理(无论是在 Animator 中的更低层还是在不同的可播放层中),那么第一个动画的内容将被第二个动画覆盖(除非第二个图层是添加层,如果是,则将两个动画相加)前者的动画会被后者覆盖(除非另一个层是 Additive 层,在这种情况下,它会叠加在前者之上)。
对于变换,这只会在第二个动画使用对于 Transform,这种情况仅在第二个动画使用 WD 关闭并且是在更晚应用的可播放图层上发生时发生。off 并且位于一个稍后应用的 Playable Layer 时发生。
所以,例如,如果我们没有遮罩,如果你在手势层上为手部移动制作一个人形肌肉动画,然后在特效层上使用另一个动画来制作面部表情,而这个动画也恰好为人形肌肉制作动画,那么手部移动的值将被特效层覆盖。如果没有 Avatar Mask,如果你在 Gesture Layer 中为手部动作做了动画处理,而在 FX Layer 中使用了不同的动画处理面部表情(同时也处理了 Humanoid Muscle),那么手部的值将被 FX Layer 覆盖。
注意:
这意味着,如果你有一个这意味着,如果你有一个人形动画,如果不只是屏蔽你想要启用的人形肌肉,而其他部分被禁用,那么所有其他的人形肌肉都将被覆盖。Humanoid 动画,没有进行适当的 Avatar Mask 以启用所需的 Humanoid Muscle 数值并禁用其他数值,所有其他 Humanoid Muscle 数值将会被覆盖。
这也意味着,如果你在手势层上有变换动画,而你在特效层上有一个未加遮罩的如果你在 Gesture Layer 中有 Transform 动画,而在 FX Layer 中有一个未进行 Avatar Mask 的 WD 关闭变换动画,那么所有手势层变换动画都将被覆盖。Off Transform 动画,所有 Gesture Layer 中的 Transform 动画将会被覆盖。
默认的 VRChat FX 层使用了一个未加遮罩的Layer 使用了未进行 Avatar Mask 的 WD 关闭混合树。这可能会导致变换动画在off 混合树。这可能导致在 VRChat 中无法播放,只要你在使用默认特效层。如果你想在手势层上制作变换动画,你必须使用自己的特效层或者删除默认的并设置为空。
Transform 动画无法播放,只要你使用默认的 FX Layer。如果你想在 Gesture Layer 中进行 Transform 动画,你必须使用你自己的 FX Layer 或者移除默认的 FX Layer 并将其设置为空。
VRChat layer behaviour层行为
All所有 playablePlayable layersLayers are会依次播放。首先是 playedBase one层,然后是 afterAdditive the层,接着是 other.Gesture First the Base, then Additive, then Gesture, then层,然后是 Action and层,最后是 lastlyFX FX.层。
On the first four layers (Base, Additive, 在前四个层(Base、Additive、Gesture &和 Action),Action)中,你应该只使用影响 youTransform(无论是 shouldHumanoid onlyMuscle use还是 animationsTransform which动画)和开关 affectGameObject transforms (so either humanoid muscles or transform animations) and toggle gameobjects on/off.的动画。
This这不是因为 isn'tAvatar becauseMask,而是因为这四个层只在你的本地 ofAvatar masking,克隆体上播放,而不会在你的镜像和阴影克隆体上播放。VRChat but复制本地 becauseAvatar these上每个 fourGameObject layers的 areTransform played和开关状态,并将它们应用到 onlyAvatar on的镜像和阴影克隆体上。然而,VRChat your不会复制除了 localTransform avatar和每个 clone,GameObject but的开关状态之外的任何内容,这意味着如果你动画处理了其他内容,如 notblendshapes、材质球替换或着色器设置,VRChat on不会将这些属性复制到镜像和阴影克隆体。克隆体会播放自己的 yourFX mirrorLayer,这就是为什么除了 andTransform shadow和 clones.GameObject 的开关状态之外的内容应该在 FX Layer 中进行动画处理的原因。
例如:如果你在 Base Layer 中进行材质球替换,它不会在镜像和阴影克隆体上生效。
本文仅详细讨论了 Avatar Mask 和行为。如果你想了解更多关于 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 find this at the following page:推荐的层使用方法,你可以在以下页面找到更多信息:
Playable Layers | VRChat Creation
Base Layers基本动画层
Base
ThisBase layer该层应仅动画处理 shouldTransform(无论是直接还是通过 onlyHumanoid animate transforms (either directly or through humanoid muscles) and/orMuscle)和/或 GameObject on/off states for the reasons stated above.的开关状态。
VRChat recommends推荐将此层用于运动,并仅动画处理 thisHumanoid layer to be used for locomotion and to only animate humanoid muscles.Muscle。
Additive
ThisAdditive layer该层应仅动画处理 shouldTransform 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推荐将此层用于运动的调整,如呼吸效果,并仅动画处理 thisHumanoid layer to be used for tweaks to locomotion, like breathing effects, and to only animate humanoid muscles.Muscle。
Gesture
This该层应仅动画处理 layerTransform should only animate transforms and/or和/或 GameObject on/off states for the reasons stated above. It has some special behaviour, namely that的开关状态。它有一些特殊的行为,即 VRChat takes会将第一层的 theAvatar maskMask on应用到所有层上,如果在这个 theAvatar firstMask layer,或层的 andAvatar appliesMask it中禁用了动画(无论是 toHumanoid all还是 the layers in a way where if an animation (humanoid or transform) is disabled in either this mask or the layer mask itself, it is disabled.Transform),它会被禁用。
So因此,如果你想动画处理任何 ifHumanoid youMuscle,你必须制作一个专门允许这些肌肉的 wantAvatar toMask animate any of the humanoid muscles, you will have to make a mask that specifically allows those muscles and put it in the top layer.并将其放在顶部层中。
And if you want to animate any transforms with如果你想动画处理任何带有 WD off,Off you的 willTransform,你必须制作一个专门允许这些 haveTransform to并禁用其他的 makeAvatar a mask that specifically allows those transforms and disables the others, and put it in the top layer.Mask,并将其放在顶部层中。
VRChat recommends推荐将此层用于动画处理 thisTransform layer和仅影响特定身体部位的 toHumanoid be used for animations that animate transforms and humanoid animations that only affect certain body parts.动画。
Action
This该层应仅动画处理 layerTransform should only animate transforms and/or和/或 GameObject on/off的开关状态。该层默认情况下的权重为零。在你在 statesAction for the reasons stated above. This layer is blended to zero by default. Before you do anything in the action layer, you need to use the层中进行任何操作之前,你需要使用 Playable Layer Control State Behavior to blend this layer up before transitioning to the actual action you're performing. Make sure you blend it back to zero when you're done, otherwise other animations won’t play.将该层混合到一个值,然后再过渡到你要执行的实际操作。当你完成后,确保将其混合回零,否则其他动画将全部被覆盖。
VRChat recommends推荐将此层用于覆盖前面层中的任何 thisHumanoid layer to be used to overwrite any humanoid animations from the previous layers, like for example for emotes or动画,例如表情或 AFK animations.动画。
FX
Since由于该层在所有克隆体上运行,因此这是你可以运行任何动画的地方。请注意,您仍然可以对 thisTransform layer进行动画处理,只要有适当的 runsAvatar on all your clones, this is where you can run any animations. Note that you can still animate transforms, given the right masking.Mask。
If如果第一层 theAvatar firstMask layer为空,它将创建一个默认的 maskAvatar isMask,禁用所有 empty,Humanoid itMuscle will数值并启用所有 createTransform,并将其应用到所有层上,使其在这个 aAvatar defaultMask mask或层的 thatAvatar disablesMask all humanoid muscles and enables all transforms, and applies it to all the layers in a way where if it is disabled in either this mask or the layer mask itself, it is disabled.中禁用的内容会被禁用。
If如果第一层 theAvatar firstMask layer不为空,它将采用第一层 maskAvatar isn't empty, it will take the first layer mask and apply it to all layers in the same way.Mask,并以相同的方式应用到所有层。
So因此,如果你想动画处理任何 ifHumanoid youMuscle,你必须制作一个专门允许这些肌肉并关闭肌肉的 wantAvatar toMask animate any of the humanoid muscles, you will have to make a mask that specifically allows those muscles and denies the others and put it in the top layer. If you don’t deny them, they will replace the并将其放在最顶层。如果你不关闭,它们将会覆盖 Gesture animations on them.动画中的内容。
If you are using如果你使用 WD off,off,同样的逻辑也适用于 this same logic applies to transforms.Transform。
VRC'sVRC default的默认 FX layer层有一个混合树,写入默认值为关闭,这可能会破坏 hasTransform a动画。如果你想在任何层上使用 blendtreeTransform with write defaults off, this can break transform animations. If you want to use transform animations on any layer, do not use the default动画,请不要使用默认的 VRC FX layer.层。
VRChat recommends推荐将此层用于所有非 thisTransform layer动画的内容,例如启用/禁用 to be used for anything that isn’t transform animations, like enabling/disabling GameObjects, components, material swaps, shader animations, particle system animating, etc.GameObjects、组件、材质球替换、着色器动画、粒子系统动画等。
Special Layers特殊层
T-pose:
The T-Pose is用于确定 usedAvatar to的各种测量值,特别是视点(或视角球)的放置。它独立播放,因此 determineAvatar variousMask measurements of your avatar, especially for placement of your viewpoint (or view-ball). It is played on its own, so masking doesn't really matter并不重要。
IK Pose:
IK Pose is used to determine major joint bends. In the用于确定主要关节的弯曲。在 IK pose,姿势中,你的关节应该略微弯曲,以符合其弯曲方向。它独立播放,因此 yourAvatar jointsMask should be bent slightly in the direction they're intended to bend. It is played on its own, so masking doesn't really matter并不重要。
Sitting Pose:
The这个控制器用于动画和姿势。当你坐下时,Avatar controller的视点会用于校准。动画播放后,你可以创建一个“坐下”动画以及一个“坐着”的闲置动画。它像 usedAction in层一样使用,会覆盖所有的 thisHumanoid slot is used for both animation and posing. When you sit, the viewpoint of your avatar is used for calibration. The animation is played, allowing you to create a "sitting down" animation, as well as a "sitting" idle animation. It is used like Action, where it should override all humanoid animations to make your character sit.动画,以使角色坐下。