> 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/how-lip-sync-works.md).

# 口型同步的工作原理

了解 Convai 如何在音频之外提供面部动画数据、支持的口型同步模式，以及 AnimGraph 节点如何应用这些数据。

当你的 Convai 角色开口说话时，会同时到达两样东西：语音音频和一段匹配的面部动画数据序列。插件会将它们同步播放，因此角色的嘴巴、下颌和脸颊会随着每个词同步移动。本页说明了该管线的工作方式、六种口型同步模式，以及 Face Sync AnimGraph 节点如何应用这些数据。

### 预计算数据管线

Convai 会同时生成音频和按帧索引的 blendshape 数据序列。每一帧都携带特定时间点每条面部曲线对应的一个浮点值。该序列会在音频之前到达或与音频同时到达，因此角色一开始说话，面部就已准备好进行动画。

该 `Convai Face Sync` 该组件会缓存传入的帧，并在每个引擎 Tick 中暴露当前帧。 `Convai Face Sync` AnimGraph 节点通过该缓冲区读取数据， `Convai 聊天机器人` 读取同一 Actor 上的 component，然后在写入结果曲线值到动画姿势之前，应用重映射和 alpha 缩放。

之所以预先计算数据而不是在运行时推断，是为了避免在客户端增加一个机器学习推理步骤。Convai 已经拥有文本转语音的合成上下文，因此它可以在没有本地 viseme 模型额外延迟的情况下生成准确的 blendshape 时序。

```mermaid
graph TD
    A["Convai"] -- "音频 + 面部动画帧" --> B["Convai 面部同步组件"]
    B -- "每个 Tick 的当前帧" --> C["Convai Face Sync 节点（AnimGraph）"]
    C -- "曲线权重" --> D["角色面部网格"]
```

当项目范围的 **口型同步模式** 是 `自动`时，插件会读取每个角色的 `Convai Face Sync` 组件的 `LipSyncMode` 在运行时以选择匹配的格式。将项目范围模式设置为 `关闭` 会为整个项目禁用面部动画。

### 口型同步模式

该 `EC_LipSyncMode` 枚举既出现在项目设置中，也出现在 `UConvaiFaceSyncComponent`。诸如 `关闭`, `基于音素`, `BS_MHA`，以及 `BS_ARKit` 会在连接设置期间选择格式。当项目范围的值为 `自动`时，插件会读取所附组件的 `LipSyncMode` 值，以便每个角色都能使用与其骨架匹配的格式。

| 模式                | 显示名称             | 目标骨架                     | 备注                                                                                                |
| ----------------- | ---------------- | ------------------------ | ------------------------------------------------------------------------------------------------- |
| `关闭`              | `关闭`             | —                        | 禁用面部动画。不会向 Convai 请求面部数据。                                                                         |
| `自动`              | `自动`             | 按角色的骨架                   | 读取每个角色的 **Convai Face Sync** 组件 `LipSyncMode` 在运行时以选择格式。当项目中的不同角色使用不同骨架时使用。                       |
| `基于音素`            | `基于音素口型`         | 带 OVR viseme 曲线的自定义骨架    | 15 个音素曲线： `静音`, `PP`, `FF`, `TH`, `DD`, `kk`, `CH`, `SS`, `nn`, `RR`, `aa`, `E`, `ih`, `oh`, `ou` |
| `BS_MHA`          | `MetaHuman 混合变形` | MetaHuman 和 CC5 角色       | MetaHuman CTRL 曲线名称。默认模式。                                                                         |
| `BS_ARKit`        | `ARKit 混合变形`     | CC4 角色                   | 61 个 ARKit blendshape 曲线名称（52 个标准 Apple ARKit + 9 个头部/眼睛旋转）。                                      |
| `BS_CC4_Extended` | `CC4 扩展混合变形`     | 启用扩展 blendshape 的 CC4 角色 | CC4 扩展曲线名称。                                                                                       |

#### 选择模式

该模式必须与烘焙到角色 Skeletal Mesh 中的 blendshape 格式匹配：

* **MetaHuman 混合变形** — 用于 MetaHuman 角色以及配置为兼容 MetaHuman 曲线的 CC5 角色。
* **ARKit 混合变形** — 用于导出标准 ARKit blendshape 集的 CC4 角色。
* **CC4 扩展混合变形** — 用于在 Character Creator 4 中启用扩展 blendshape 选项导出的 CC4 角色。
* **基于音素口型** — 用于自定义骨架，其中你已手动创建以表格中列出的 15 个音素目标命名的曲线。
* **自动** — 当不同角色使用不同骨架时，用作项目范围设置。插件会读取每个角色的 `Convai Face Sync` 组件模式在运行时。
* **关闭** — 用于在项目范围内完全禁用面部动画。

{% hint style="warning" %}
如果该模式与骨架不匹配，AnimGraph 节点会收到来自 Convai 的数据，但找不到要写入的匹配曲线名称。面部不会播放动画，并且不会记录错误。请始终确认所选模式与角色 Skeletal Mesh 上存在的曲线名称相匹配。
{% endhint %}

### AnimGraph 集成

该 `FAnimNode_ConvaiFaceSync` 节点放置在 Animation Blueprint 的 AnimGraph 中，位于姿势源和输出之间。它会解析 `UConvaiChatbotComponent` 所属 Actor 上的 component，读取通过该聊天机器人口型同步组件提供的 blendshape 帧，应用上脸和下脸的 alpha，进行可选平滑处理和可选的 starvation blending，然后输出修改后的姿势。

该节点会自动查找 `UConvaiChatbotComponent` 所属 Actor 上的 `ConvaiChatbotComponent` pin 保持未设置。如果 Actor 有多个 chatbot 组件，请显式连接该 pin 以避免歧义。

对于 MetaHuman 设置，请按照 [设置 MetaHuman 角色](/api-docs/zh/cha-jian-yu-ji-cheng/convai-unreal-engine-plugin/getting-started/set-up-a-metahuman-character.md)中的说明分配随附的 Convai 动画类。对于自定义 Animation Blueprint，请参见 [Face Sync AnimGraph 节点参考](/api-docs/zh/cha-jian-yu-ji-cheng/convai-unreal-engine-plugin/features/lip-sync/face-sync-animgraph-node-reference.md).

#### 缓冲耗尽混合

当动画缓冲区耗尽数据时——例如在两次说话之间或第一帧到达之前——节点会平滑地将面部淡回中性，而不是将其冻结在最后一个姿势上。

在一次说话结束到下一批帧到达之间，缓冲区是空的。节点使用 `StarvationBlendInDuration` 和 `StarvationBlendOutDuration` 来平滑地淡入和淡出曲线，而不是将面部猛然切回中性再切回。比如，持续 `0.8` 秒的淡出时间可以让嘴巴在说话结束后自然收拢，而不是立刻闭合。

#### 上脸和下脸拆分

语音数据有时会让眉毛和眼睑以在屏幕上看起来不自然的方式移动。节点允许你独立减少上脸动作，同时保留完整的嘴唇动画。

该节点使用 `UpperFaceBlendshapeNames` 数组将 blendshape 分为上脸（眉毛、眼睛、眼睑）和下脸（下颌、嘴唇、脸颊）两组。每组都会应用单独的 alpha。这样你就可以减少语音带来的眼部/眉部运动——这通常是噪声——同时保持完整的嘴唇幅度。

### 相关概念

{% content-ref url="/pages/8b7003d8fdf40c7b56b0fd2a54376bfc5105903c" %}
[Face Sync 组件参考](/api-docs/zh/cha-jian-yu-ji-cheng/convai-unreal-engine-plugin/features/lip-sync/face-sync-component-reference.md)
{% endcontent-ref %}

{% content-ref url="/pages/ed19695d8a46eb28447110735f1f0dfe84079492" %}
[Face Sync AnimGraph 节点参考](/api-docs/zh/cha-jian-yu-ji-cheng/convai-unreal-engine-plugin/features/lip-sync/face-sync-animgraph-node-reference.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/how-lip-sync-works.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.
