基于FaceARSample官方例子,打开LiveLink插件等
UE4引擎插件里脸部数据结构划分EARFaceBlendShape(下图代码),官方例子自带脸部曲线动画由于该结构做出来,所有直接放上模型动画资源就能捕获脸部数据动起来,如果自定义动画(建议按官方脸部划分结构做动画姿态),可能就需要动画曲线映射。
enum class EARFaceBlendShape : uint8
{
// Left eye blend shapes
EyeBlinkLeft,
EyeLookDownLeft,
EyeLookInLeft,
EyeLookOutLeft,
EyeLookUpLeft,
EyeSquintLeft,
EyeWideLeft,
// Right eye blend shapes
EyeBlinkRight,
EyeLookDownRight,
EyeLookInRight,
EyeLookOutRight,
EyeLookUpRight,
EyeSquintRight,
EyeWideRight,
// Jaw blend shapes
JawForward,
JawLeft,
JawRight,
JawOpen,
// Mouth blend shapes
MouthClose,
MouthFunnel,
MouthPucker,
MouthLeft,
MouthRight,
MouthSmileLeft,
MouthSmileRight,
MouthFrownLeft,
MouthFrownRight,
MouthDimpleLeft,
MouthDimpleRight,
MouthStretchLeft,
MouthStretchRight,
MouthRollLower,
MouthRollUpper,
MouthShrugLower,
MouthShrugUpper,
MouthPressLeft,
MouthPressRight,
MouthLowerDownLeft,
MouthLowerDownRight,
MouthUpperUpLeft,
MouthUpperUpRight,
// Brow blend shapes
BrowDownLeft,
BrowDownRight,
BrowInnerUp,
BrowOuterUpLeft,
BrowOuterUpRight,
// Cheek blend shapes
CheekPuff,
CheekSquintLeft,
CheekSquintRight,
// Nose blend shapes
NoseSneerLeft,
NoseSneerRight,
TongueOut,
// Treat the head rotation as curves for LiveLink support
HeadYaw,
HeadPitch,
HeadRoll,
// Treat eye rotation as curves for LiveLink support
LeftEyeYaw,
LeftEyePitch,
LeftEyeRoll,
RightEyeYaw,
RightEyePitch,
RightEyeRoll,
MAX
};
1、EvaluateLiveLinkFrame和GetPropertyValue获取苹果手机捕获脸部变化值,可以用来修改脸部曲线动画。其中GetPropertyValue输入值PropertyName就是当前脸部枚举结构EARFaceBlendShape枚举值,返回当前结构变化值。
2、 ModifyCurve节点动画曲线修改自定义曲线动画,可以根据GetPropertyValue获取值输入修改。右击ModifyCurve节点就出现出现菜单栏,选择下方项AddCurvePin可以选择当前已存在各种动画曲线。
3、Transform(Modify)Bone节点,可以根据GetPropertyValue获取输入值相应骨骼位置修改。
4、LiveLinkRemapAsset里三个映射函数,根据不同部位结构返回相应自定义动画曲线播放。首先创建LiveLinkRemapAsset的子类蓝图,在其子类重载定义GetRemappedCurveName等三个映射函数。
LiveLinkRemapAsset的子类蓝图路径引用位置,如下
LiveLinkRemapAsset的子类蓝图三个映射函数如下
GetRemappedCurveName映射动画曲线函数根据脸部枚举值返回自定义曲线,输出值CurveName就是当前脸部枚举结构EARFaceBlendShape枚举值字符串,通过 SitchOnName节点比较EARFaceBlendShape枚举值返回对应动画资源,如下