> For the complete documentation index, see [llms.txt](https://docs.convai.com/api-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.convai.com/api-docs/zh/cha-jian-yu-ji-cheng/convai-unreal-engine-plugin/features/lip-sync/lip-sync-usage-examples.md).

# 口型同步使用示例

为常见场景配置口型同步：叠加与覆盖混合、平滑调优、与身体动画混合，以及将 blendshape 重新映射到自定义骨骼。

这些示例涵盖了最常见的 `FAnimNode_ConvaiFaceSync` 配置。每个示例都会说明使用场景、需要更改的节点或组件设置，以及预期结果。

### Add 与 Override 混合模式

当多个动画系统同时写入相同的面部曲线（例如待机动画和 Convai 唇形同步）时，需要决定 Convai 的值如何与现有动画组合。

#### 在待机动画上叠加唇形同步

当 `ApplyMode = Add` 身体动画或待机动画已经驱动某些面部曲线时（例如让下颌轻微活动的细微呼吸动画），请使用此模式。Convai 的值会叠加到源姿势已有的内容上，因此两种动画可以同时发挥作用。

在 AnimGraph 节点的 **Details** 面板中：

| 属性          | 值     |
| ----------- | ----- |
| `ApplyMode` | `Add` |

源姿势动画保留其面部曲线，Convai 的值则叠加其上。

#### 让 Convai 成为唯一驱动源

当 Convai 应负责驱动所有动画曲线，且任何待机面部动画都会造成冲突时，请使用 `ApplyMode = Override` （例如，角色待机动画使用的眉毛曲线会与 Convai 的情绪数据相冲突）。

在 AnimGraph 节点的 **Details** 面板中：

| 属性          | 值          |
| ----------- | ---------- |
| `ApplyMode` | `Override` |

源姿势曲线会被 Convai 帧值完全替换。

### 调整平滑效果

#### 平滑唇部运动以减少抖动

语音混合变形数据可能导致帧与帧之间变化迅速，在屏幕上看起来会有抖动，尤其是面部下半部分。启用下半脸平滑功能并设置适中的速度，可让动作更加平稳，同时避免产生明显延迟。

在 AnimGraph 节点的 **Details** 面板中：

| 属性                          | 值      |
| --------------------------- | ------ |
| `bEnableLowerFaceSmoothing` | `true` |
| `LowerFaceSmoothingSpeed`   | `0.4`  |

设为 `0.4` 时，唇部运动会更平滑，同时仍能保持灵敏。向 `0.1` 调低，可获得更强的平滑效果，但延迟也会增加；向 `1.0` 调高，则响应更快，但平滑效果会减弱。默认值 `1.0` 表示立即响应，不进行平滑处理。

#### 抑制眉毛和眼部动作

语音数据有时会包含与角色情绪不符或看起来不自然的眉毛和眼睑动作。降低 `UpperFaceAlpha` 的值，可以减少上半脸曲线的影响，而不必将其完全禁用。

在 AnimGraph 节点的 **Details** 面板中：

| 属性               | 值     |
| ---------------- | ----- |
| `UpperFaceAlpha` | `0.2` |

将 `UpperFaceAlpha` 设为 `0.0` ，即可完全抑制上半脸混合变形，同时保留完整的唇部动画。

### 与身体动画混合

#### 保留身体动画曲线

当 Animation Blueprint 将身体层和面部层串联起来时，请确保将 `Convai Face Sync` 节点放在身体层节点之后、最终输出之前。使用 `ApplyMode = Add` 以保留身体层的任何面部曲线（例如眨眼动画轨道）。

AnimGraph 中的顺序应为：

1. 身体动画节点（生成包含身体动画和待机面部曲线的源姿势）
2. `Convai Face Sync` 节点（读取源姿势并添加 Convai 曲线）
3. 输出姿势

此顺序可确保闲置眨眼和其他身体层级的面部动画与 Convai 口型同步效果同时保留。

### 自定义混合变形映射

#### 将一条 Convai 曲线映射到两条骨骼曲线

某些自定义骨骼网格会将单个嘴部动作拆分为左右两个目标曲线。例如，MetaHuman 源曲线 `CTRL_expressions_jawOpen` （来自 Convai）可能需要驱动自定义骨骼网格上的两个用户定义目标曲线。

在 AnimGraph 节点上的 `BlendshapeMapping` 表格中添加一项：

| 键（`FName`)                 | `TargetNames`                            | `Multiplyer` | `Offset` |
| -------------------------- | ---------------------------------------- | ------------ | -------- |
| `CTRL_expressions_jawOpen` | `["InstructorJaw_L", "InstructorJaw_R"]` | `1.0`        | `0.0`    |

两个自定义目标曲线都会接收与源曲线相同的值 `CTRL_expressions_jawOpen` 曲线。

#### 缩小曲线以防止穿插

如果某条特定曲线在某个网格体上造成的变形过大，请添加一个映射项，并降低其 `Multiplyer`:

| 键（`FName`)                 | `TargetNames`                  | `Multiplyer` | `Offset` |
| -------------------------- | ------------------------------ | ------------ | -------- |
| `CTRL_expressions_jawOpen` | `["CTRL_expressions_jawOpen"]` | `0.6`        | `0.0`    |

目标曲线将接收输入值的 `60%` 。除非 `GlobalMultiplier` 仍会生效，除非 `IgnoreGlobalModifiers` 设为 `true` （在此映射项中）。

#### 将曲线固定为指定值

若要阻止 Convai 驱动某条特定曲线（例如，无论语音数据如何都让眼睛保持完全睁开），请添加一个映射项，并设置 `UseOverrideValue = true`:

| 键（`FName`)                   | `TargetNames`                    | `UseOverrideValue` | `OverrideValue` |
| ---------------------------- | -------------------------------- | ------------------ | --------------- |
| `CTRL_expressions_eyeBlinkL` | `["CTRL_expressions_eyeBlinkL"]` | `true`             | `0.0`           |

该曲线将保持在 `0.0` 不受输入数据影响。

### 录制并重放口型同步序列

#### 捕获用于过场动画播放的响应

使用录制 API 在对话过程中捕获实时口型同步序列，并在之后重放，例如用于非交互式过场动画或预热的响应缓存。

录制 API 仅支持 C++。 `StartRecordingLipSync()`, `FinishRecordingLipSync()`, `PlayRecordedLipSync()`, `IsPlaying()`，以及 `GetCurrentFrame()` 都是 `UConvaiFaceSyncComponent` 上的普通 C++ 方法，不带 `UFUNCTION` 修饰。

```cpp
// 伪代码
UConvaiFaceSyncComponent* FaceSync = MyCharacter->FindComponentByClass<UConvaiFaceSyncComponent>();

// 1. 在语音轮次开始之前或开始时启动录制。
FaceSync->StartRecordingLipSync();

// 2. 角色说话——帧会自动捕获。

// 3. 在轮次结束时停止录制并保存序列。
FAnimationSequenceBP CachedSequence = FaceSync->FinishRecordingLipSync();

// 4. 在需要时（例如触发过场动画时）重播序列。
//    参数：录制的序列、起始帧（0 = 开始），
//    结束帧（-1 = 末尾）、覆盖时长（0.0 = 使用录制时长）。
FaceSync->PlayRecordedLipSync(CachedSequence, 0, -1, 0.0f);
```

{% hint style="info" %}
使用 `IsPlaying()` 轮询重播是否正在进行，并使用 `GetCurrentFrame()` 读取实时混合变形值，供音频驱动效果或口型同步调试叠加层等辅助系统使用。
{% endhint %}

### 后续步骤

{% content-ref url="/pages/ed19695d8a46eb28447110735f1f0dfe84079492" %}
[Face Sync AnimGraph 节点参考](https://docs.convai.com/api-docs/zh/cha-jian-yu-ji-cheng/convai-unreal-engine-plugin/features/lip-sync/face-sync-animgraph-node-reference.md)
{% endcontent-ref %}

{% content-ref url="/pages/37d2872ffdb903e0d2cf86a4c12dfd99660c927f" %}
[录制并回放口型同步](https://docs.convai.com/api-docs/zh/cha-jian-yu-ji-cheng/convai-unreal-engine-plugin/features/lip-sync/record-and-replay-lip-sync.md)
{% endcontent-ref %}

{% content-ref url="/pages/b0b44be9f2ee8ca031b08c9677450b5f826a9c8c" %}
[排查口型同步问题](https://docs.convai.com/api-docs/zh/cha-jian-yu-ji-cheng/convai-unreal-engine-plugin/features/lip-sync/troubleshoot-lip-sync.md)
{% endcontent-ref %}

{% content-ref url="/pages/713990439742181b882d6f2ca1521bb051a162be" %}
[口型同步的工作原理](https://docs.convai.com/api-docs/zh/cha-jian-yu-ji-cheng/convai-unreal-engine-plugin/features/lip-sync/how-lip-sync-works.md)
{% endcontent-ref %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.convai.com/api-docs/zh/cha-jian-yu-ji-cheng/convai-unreal-engine-plugin/features/lip-sync/lip-sync-usage-examples.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
