UE动画节点 —— Blend Node

参考:https://docs.unrealengine.com/5.0/en-US/animation-blueprint-blend-nodes-in-unreal-engine/


Blend Node

本文主要讲UE的AnimGraph的动画蓝图里,负责把多个动画blend到一起的Blend节点,如下图所示,Blend Node在动画蓝图里,节点标题颜色都是灰色的:
在这里插入图片描述

BlendNode根据功能可以分为下面几类:

  • Apply Additive: 负责把Blend Base动画和Additive动画的两个Pose相加
  • Make Dynamic Additive:与Additive正好相反,它是两个Pose相减,算出Delta Pose
  • Blend:就是普通的Blend两个动画输出的Pose
  • Blend Bone by Channel:只Blend特定的Pose里的部分Bone的Transform
  • Blend Multi:Blend的升级版,可以Blend多个动画输出的Pose

Unreal的Blend Node是把多个Animation输出的Pose,Blend到一起。实际动画系统还有从Pose A Blend到Pose B的需求(在Unity里叫做Cross Fade),由于这种动画的转态,往往还提供了逻辑判断。比如什么时候触发Cross Fade,所以UE提供了一种新的用于动画转态的动画节点,叫做叫做Function Blend Node,有如下几类,它们都可以设置Blend用时:

  • Blend Poses by bool:提供两个Pose可以过度,根据bool选择过渡到哪一个Pose
  • Blend Poses by int:提供多个Pose可以过度,根据int选择过渡到哪一个Pose
  • Blend Poses by Enumeration (Enum):跟上面的差不多,无非是根据Enum选择过渡到哪一个Pose
  • Layered Blend per Bone:只Blend部分Bones,相当于Unity里带AvatarMask的Layer Blending

此时的标题节点颜色为绿色,如下图所示:
在这里插入图片描述


一些详细说明补充如下:

Blend Poses by bool示例
举个例子,如下图所示,水平这个轴是正常的人物移动的流程,当人物停止移动,则会Blend到False Pose对应的Bind Pose上,当然这个Local Space Ref Pose换成Play Idle Node应该会更好一点。
在这里插入图片描述

Blend Poses by Enumeration (Enum)
UE4版本应该是默认会为每个Enum值添加对应Pose的Pin,不过UE5这里需要右键选择添加枚举类型的Pin。顺便说一句,UE里还可以创建Enum资产,而不需要写代码。
**加粗样式**


Inertialization

这个词不是Initialization,而是Inertialization,意思是惯性。UE提出的Inertial Blending是一种高性能的动画后处理技术,能够作为传统动画crossfading技术的替代手段。这个概念是从UE4.26才开始正式进入官方文档的。

如果要使用它,需要添加Inertialization节点:
在这里插入图片描述

State Machine Transitions, Blend Nodes, Linked Anim Graphs and Linked Anim Layers, can all trigger inertial blends.

上面引用提到的这些动画节点,都可以trigger inertial blends,也叫提出inertial blend requests,作为后处理节点,只要保证提出requests的节点都在其Input Tree上即可,比如这里直接连到Output Pose,如下图所示:
在这里插入图片描述

PS: If your AnimGraph contains a Inertialization request but is missing an Inertialization node, a runtime error will be logged in the Message Log panel.

具体原理不是很清楚,总之Initialization Node会一直记录Root的Motion和对应Motion Curve的改变,感觉类似于人工智能在动画里的应用,相当于基于人物的移动路径和惯性,去修正人物的Pose。在使用inertial blending的时候,动画状态机的逻辑需要改一改,人物此时的动画转态,都应该是在人物的Movement里进行的。inertial blending会去自然的接管Pose,所以没有必要去手动设置,让人物转回Idle状态。inertial blending尤其适用于短暂的动画过度(Short blends work best since inertial blending is a post-process for easing motion toward a target animation).

Inertial blends can be interrupted with other inertial blends, but try to avoid scenarios that cause continuous interruptions because subsequent blend durations may be trimmed to keep the pose stable.

动画Graph允许放置多个Initialization Node,每个节点都会负责处理它们source pose的inertial blend。举几个例子:

  • 使用两个动画层,一个负责上半身,一个负责下半身,每个层各自连一个Initialization Node,然后通过Layered Blend per Bone把两层合到一起,作为最终Pose
  • 使用Base动画加Additive动画时,可以在Base动画里接一个Initialization Node,添加Additive动画后,再接一个Initialization Node
  • 需要使用IK时,可以在Base动画里接一个Initialization Node,再添加IK(For final pose fixups, you will generally run Inertialization before IK, which effectively does inertial blending in IK space),然后可能再接一个Initialization Node?

Note:
A Source pose stops being evaluated once inertial blending begins. As a result, Animation Notifies from the source animation Sequence will no longer trigger after inertial blending begins. You may need to refactor existing game logic and Anim Notifies to be compatible with Inertialization.

inertial blending开始时,Source pose会停止被evaluated,对应的Animation Notifies不再会被触发。


介绍一下在动画蓝图里让节点使用Inertial blends的操作,下面几种情况的前提都是Graph里有Initialization Node的存在

Request from Blend Nodes

直接在这里设置:
在这里插入图片描述

Request from State Machine Transitions

在动画转态上设置:
在这里插入图片描述

Request from Linked and Layered AnimGraphs

Inertialization properties can also be defined in an Animation Layers or from a Linked Anim Graph. After selecting a Graph from the My Blueprints panel you can find the Graph Blending section of properties in the Details panel. An Animation Layer can blend in or out, but only via inertial blending. An Inertialization node must be placed anywhere after the Linked Anim Layer node that links this Animation Blueprint. A negative value means the blend time will be determined by the other incoming or outgoing Animation Layer.

在这里插入图片描述

猜你喜欢

转载自blog.csdn.net/alexhu2010q/article/details/125675463