> 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-unity-sdk/features/emotion/output-bindings.md).

# 情绪输出绑定

输出绑定是 Emotion 管线的最后阶段。它们每帧接收来自累加器的平滑、突发修正后的分数，并将其写入角色的面部。可用两种绑定类型： `BlendshapeEmotionBinding` 用于直接网格变形，以及 `AnimatorParameterEmotionBinding` 用于 Mecanim 驱动的骨架。两者可以同时在同一个角色上运行。

这两种绑定类型都在 `ConvaiEmotionProfile` 资源—— `BlendshapeEmotionBinding` 在 **Blendshape Binding** 部分和 `AnimatorParameterEmotionBinding` 在 **Animator Binding** 部分中配置。每个绑定都包含一个 `EmotionSlotBinding` 条目列表，其中每个槽位将一个规范情绪标签映射到一个或多个输出目标。

### EmotionSlotBinding 字段

任一绑定类型中的每个槽位都使用相同的一组字段。

| 字段                      | 类型       | 范围             | 默认值       | 说明                                                                                               |
| ----------------------- | -------- | -------------- | --------- | ------------------------------------------------------------------------------------------------ |
| `emotionLabel`          | `string` | 规范分类标签         | —         | 该槽位所响应的当前分类体系中的规范标签（例如 `"joy"`, `"anger"`）。必须与某个规范标签完全匹配——别名在此处不会解析。                             |
| `blendshapeNames`       | `string` | 以逗号或换行分隔       | —         | 角色上要驱动的 blendshape 的名称 `SkinnedMeshRenderer` 。留空可跳过该槽位的 blendshape 输出。                           |
| `animatorParameterName` | `string` | Animator 浮点参数名 | —         | 要写入的 Animator Controller 中某个浮点参数的名称。留空可跳过该槽位的 Animator 输出。                                       |
| `weightMultiplier`      | `float`  | 0 – 2          | **1**     | 应用在平滑分数之上的每槽位乘数。使用大于 1 的值可放大细微情绪，小于 1 的值可抑制强烈情绪。                                                 |
| `fullBlendshapeWeight`  | `float`  | 0 – 100        | **100**   | 当平滑分数恰好为 1.0 时写入的 blendshape 值（Unity 的 0–100 网格单位）。                                              |
| `isMouthShape`          | `bool`   | —              | **false** | 将该槽位通过 LipSync 合成器的嘴部层进行路由。参见 [isMouthShape 与 LipSync 路由](#ismouthshape-and-lipsync-routing) 下文。 |

### Blendshape 绑定

`BlendshapeEmotionBinding` 每帧直接写入角色上的一个或多个 blendshape， `SkinnedMeshRenderer` 无需 Animator Controller。

**权重计算：**

```
finalBlendshapeWeight = score × weightMultiplier × fullBlendshapeWeight
```

其中 `score` 是范围 \[0, 1] 内的平滑、突发修正后的值。

单个槽位中可以列出多个 blendshape 名称，用逗号或换行分隔。所有列出的形状都会获得相同的计算权重：

```
Brow_Raise_Inner_L, Brow_Raise_Inner_R
Eye_Wide_L, Eye_Wide_R
```

当某种情绪对左右成对形状进行对称驱动时，这很有用。

### Animator 参数绑定

`AnimatorParameterEmotionBinding` 每帧将平滑后的情绪分数作为浮点参数写入 Animator Controller。当你的面部动画由 blend tree 或状态机驱动，而不是直接的 blendshape 控制时，这是正确的选择。

要求：

* Animator Controller 必须将该参数定义为一个 **Float** 类型。
* 参数名称 **区分大小写**。槽位中的名称必须与 Animator Controller 完全匹配。
* Animator 组件必须位于 **同一个 GameObject** 作为 `ConvaiEmotionController`.

Animator 参数推荐命名约定为 `Emotion_<Label>` （例如 `Emotion_Joy`, `Emotion_Anger`）。该约定会在 `RealisticEmotionSlots` 从代码生成预设槽位列表时自动使用。

### isMouthShape 与 LipSync 路由

该 `isMouthShape` 字段控制某个槽位的输出是否通过嘴部合成器层进行路由——也就是 LipSync 在语音期间写入音素形状所使用的同一层。

{% hint style="danger" %}
设置 `isMouthShape = true` **仅** 适用于会改变嘴唇、下颌或下巴形状的形状。眉毛上扬、眼睛眯起、脸颊鼓起以及所有上半脸形状都必须为 `isMouthShape = false`.

将一个非嘴部形状标记为 `isMouthShape = true` 会使其通过 LipSync 合成器路由，在说话期间这些形状会被抑制或混合。结果是上半脸动画（抬眉、睁大眼睛）在角色说话时失效——这是一个静默但明显错误的视觉效果，而且不会产生任何控制台警告。
{% endhint %}

**适用场景 `isMouthShape = true`:**

| 形状类别          | `isMouthShape` |
| ------------- | -------------- |
| 嘴角、嘴唇拉伸、微笑、皱眉 | `true`         |
| 张嘴、嘴唇压紧、酒窝    | `true`         |
| 抬眉、压眉、眯眼      | `false`        |
| 睁眼、眨眼         | `false`        |
| 抬颊、鼓腮、鼻翼皱起    | `false`        |

### 预构建槽位工厂

对于受支持的骨架， `RealisticEmotionSlots.Build(RigConvention rig)` 会生成一个完整的、受 FACS 启发的槽位列表，覆盖 Plutchik 的全部九种情绪。这消除了受支持角色类型的手动槽位编写工作。

**支持的骨架约定：**

| `RigConvention`         | 说明                                                                            |
| ----------------------- | ----------------------------------------------------------------------------- |
| `ReallusionCC4Extended` | 带扩展面部配置文件的 Reallusion CC4。最丰富的槽位集合——使用按侧的压缩、拉伸和上提形状。                          |
| `ReallusionCC3`         | Reallusion CC3 基础配置文件。与 CC4 Extended 具有相同的语义覆盖范围，但使用基础配置文件中可用的形状。             |
| `ARKit`                 | Apple 的 52-blendshape 约定。使用 camelCase 命名（例如 `mouthSmileLeft`, `browInnerUp`). |

仅 `ReallusionCC4Extended`, `ReallusionCC3`，以及 `ARKit` 由该工厂明确支持。对于任何其他骨架，请使用上面的字段表手动编写槽位。

{% hint style="info" %}
`RealisticEmotionSlots.Build()` 旨在用于程序化配置文件创建和编辑器工具。对于基于 Inspector 的编写，请直接在配置文件资源中填写槽位条目。随附的 `ConvaiSamplesShared_EmotionProfile` 是使用 CC3 预设生成的，可作为自定义槽位配置的参考。
{% endhint %}

在代码中对某个配置文件调用该工厂的方式如下：

```csharp
using Convai.Modules.Emotion.Authoring;
using Convai.Domain.Embodiment.Semantics;

// 构建 ARKit 槽位列表
var slots = RealisticEmotionSlots.Build(RigConvention.ARKit);
blendshapeBinding.SetSlots(slots);
```

### 同时使用两种绑定

Blendshape 和 Animator 绑定可以在同一个角色上同时运行。常见模式是使用 blendshape 绑定进行直接面部变形，并使用 Animator 绑定通过 blend tree 驱动次要运动（头部倾斜、耸肩、身体前倾）。两种绑定每帧都读取同一张平滑分数表，因此它们保持同步。

将任一绑定的槽位列表留空即可禁用它——控制器会跳过任何没有填充槽位的绑定。

### 下一步

{% content-ref url="/pages/5a9247365092d958f2d539ae98bdfe69f72df091" %}
[情绪配置文件](/api-docs/zh/cha-jian-yu-ji-cheng/convai-unity-sdk/features/emotion/emotion-profile.md)
{% endcontent-ref %}

{% content-ref url="/pages/830c8a41ce176512408273566b88a4c868c56a59" %}
[情绪分类法](/api-docs/zh/cha-jian-yu-ji-cheng/convai-unity-sdk/features/emotion/emotion-taxonomy.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 dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.convai.com/api-docs/zh/cha-jian-yu-ji-cheng/convai-unity-sdk/features/emotion/output-bindings.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
