> 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/embodiment/emotion/output-bindings.md). Agents can also search and read this documentation through its [MCP server](https://docs.convai.com/api-docs/~gitbook/mcp).

# Emotion 输出绑定

Emotion 模块着色器属性输出绑定的参考，用于驱动脸红、泪光或汗光等效果。

输出绑定是 Emotion 流程中可选的额外阶段，用于实现面部本身之外的效果。面部表情并非通过绑定配置，而是由共享面部合成器自动写入。本页介绍 `MaterialPropertyEmotionBinding`，这是配置文件中唯一需要配置的输出绑定，可用于腮红、泪光或汗液光泽等着色器效果。

### 面部表情如何传递到脸部

Emotion 通过共享面部合成器写入面部输出，而不是通过直接配置的绑定。表情配方只编译一次，根据角色的骨架解析，然后与 LipSync 和微表情生命层一起提交到合成器的 Emotion 图层。有关合成器的图层模型、混合模式，以及 LipSync 优先于 Emotion 的规则，请参阅 [面部合成](https://docs.convai.com/api-docs/zh/cha-jian-yu-ji-cheng/convai-unity-sdk/embodiment/facial-composition.md) 。

### MaterialPropertyEmotionBinding

`MaterialPropertyEmotionBinding` 可根据合成后的情绪分数驱动任意着色器浮点属性，例如腮红、泪光、汗液光泽或其他自定义着色器效果；SDK 不内置任何着色器知识。它在 **材质效果** 字段中配置，位于 `ConvaiEmotionProfile`上，并以 `MaterialPropertyEmotionSlot` 条目列表的形式提供。

#### MaterialPropertyEmotionSlot 字段

| 字段             | 类型       | 默认值   | 说明                                           |
| -------------- | -------- | ----- | -------------------------------------------- |
| `emotionLabel` | `string` | —     | 驱动此效果的规范分类标签（例如 `"anger"`).                  |
| `propertyName` | `string` | —     | 着色器公开的浮点属性名称（例如 `"_EmotionBlush"`）。留空则跳过此槽位。 |
| `minValue`     | `float`  | **0** | 合成强度为零时写入的属性值。                               |
| `maxValue`     | `float`  | **1** | 合成强度达到最大值 (1.0) 时写入的属性值。                     |

#### 解析与写入方式

* 目标渲染器的解析方式与面部表情输出相同：先使用骨架中的面部网格；如果没有，则扫描角色根节点下的 `SkinnedMeshRenderer` 。
* 写入操作通过每个渲染器各自的 `MaterialPropertyBlock` （获取-修改-设置）完成，因此不会修改共享材质资源，也会保留同一渲染器上其他系统对属性块所做的写入。
* **取最大值规则。** 当两个或更多槽位指向同一渲染器上的同一属性时，例如 `anger` 和一个标记为 `embarrassment`的自定义条目同时驱动 `_EmotionBlush` ，每帧都会比较它们合成后的强度，并采用强度最高的槽位所设定的 `[minValue, maxValue]` 范围，与配置顺序无关。
* **解绑时恢复初始值。** 停用控制器或切换配置文件时，会将每个被修改属性写回其槽位的 `minValue` ，而不是让属性停留在最后的情绪值。
* 即使已解析的面部网格材质未声明所配置的属性，也不会阻止写入——不受支持的 `MaterialPropertyBlock` float 写入不会产生任何效果，也不会报错；同一角色不同网格上的着色器存在差异是正常现象。
* 如果配置文件唯一编写的输出是材质属性槽，它仍会被视为有效输出；不会触发 [排查情绪问题](https://docs.convai.com/api-docs/zh/cha-jian-yu-ji-cheng/convai-unity-sdk/embodiment/emotion/troubleshooting-and-diagnostics.md).

{% hint style="warning" %}
如果所有目标材质上都找不到任何已配置的属性名称，绑定会在每次绑定时记录一条警告： `[MaterialPropertyEmotionBinding] '<name>' has authored material-property slot(s) but none of the authored shader properties (<names>) were found on any target material. Verify the property name(s) (e.g. "_EmotionBlush") match a property exposed by the character's assigned material(s).` 某些网格上未找到个别槽位、而其他网格上找到了时，不会发出警告，因为不同网格上的着色器存在差异是正常现象。
{% endhint %}

#### 示例

```csharp
// 配置文件中设置的材质绑定槽：
// { emotionLabel: "anger", propertyName: "_EmotionBlush", minValue: 0, maxValue: 0.6 }
// { emotionLabel: "fear",  propertyName: "_EmotionSweat", minValue: 0, maxValue: 1 }
```

### 共享示例分类体系和配置文件资源

Emotion 模块在以下路径中提供共享示例资源： `SamplesShared/Profiles/Embodiment/Modules/Emotion/`: `ConvaiSamplesShared_EmotionTaxonomy.asset`，以及四个命名的人格配置文件资源—— `Warm`, `Composed`, `Energetic`, `Reserved`.

1. 将角色的 **Taxonomy** 字段指向 `SamplesShared/Profiles/Embodiment/Modules/Emotion/ConvaiSamplesShared_EmotionTaxonomy.asset`.
2. 将其 **Profile** 字段指向适合该角色的四个人格配置文件之一，或使用 [角色类型预设](https://docs.convai.com/api-docs/zh/cha-jian-yu-ji-cheng/convai-unity-sdk/embodiment/emotion/emotion-profile.md#character-type-presets).
3. 角色未设置分类体系仍可运行，但所有读取该分类体系的情绪下拉菜单都会显示为空——这看起来像是 Inspector 出错，而不是缺少引用，因此请主动检查此项，不要等到控制台发出警告。
4. 这些共享资源位于软件包内。若要直接编辑其中任一资源，请先将其复制到自己的 `Assets/` 文件夹中——在软件包内所做的修改不会在软件包更新后保留。

### 后续步骤

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

{% content-ref url="/pages/ae138cae5e0a278bc48c79d0ca79ef2ef46609d4" %}
[面部组合](https://docs.convai.com/api-docs/zh/cha-jian-yu-ji-cheng/convai-unity-sdk/embodiment/facial-composition.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-unity-sdk/embodiment/emotion/output-bindings.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.
