为增强面创建自定义纹理和 3D 模型
如需实现增强现实人脸,您需要自定义纹理和模型,以便叠加在识别出的脸部网格上。这些素材资源由艺术家提前在 3D 建模和动画软件中创建,并导出为 FBX 文件。
规范文件
这些 SDK 附带一个 canonical_face_mesh.fbx
文件和一个 canonical_face_mesh.psd
文件,可帮助艺术家创建可正确叠加到 ARCore 检测到的面部上的素材资源。这些文件位于 assets/canonical_face_mesh.fbx
文件夹中。
使用 FBX 文件创建 3D 模型
FBX 文件包含脸部网格拓扑、UV 纹理坐标和定义用于创建和附加资源的支持面部区域的装备。为确保 FBX 文件与 ARCore 兼容,应使用受支持的设置保存这些文件。
此文件包含一个引用 facemesh
,不应作为最终 FBX 的一部分导出。ARCore 会在运行时生成和更新单独的面部网格。
使用 PSD 文件创建 2D 纹理
.psd
人脸网格参考纹理用于查看艺术家创建的纹理在运行时如何与用户的面部特征对齐。它包含四个层:
- 遮罩:显示眼睛、鼻孔和嘴巴在纹理中的所在位置。
- 线条:显示用户面部特征在运行时如何与纹理对齐的指南。
- UV:表示 468 点人脸纹理网格的三角化。
- 背景:中性灰色背景层,用于使其他三个组件在视觉上清晰可辨。

如果您修改了 PSD 文件,则应该会在导出后立即看到所做的更改。
自定义规范人脸网格
如果使用 SDK 中包含的 assets/canonical_face_mesh.fbx
创建模型和纹理,则在导出 FBX 文件时也需要进行以下设置:
确保所有自定义网格都已对关联的骨骼或区域进行着色。
请使用以下层次结构:
asset
|__root
| |__NOSE_TIP
| |__FOREHEAD_RIGHT
| |__FOREHEAD_LEFT
|__facemesh <-- for reference
|__ <-- place additional custom 3D meshes here
请勿导出包含的 facemesh
模型。此网格仅供参考。
ARCore 会在运行时创建单独的脸部网格。创建自定义脸部网格纹理时,请使用 facemesh
中的 UV 作为参考。
将自定义网格放置为 asset
节点的子项。
支持使用命名空间。
该资源包含四个骨骼,分别由 root
和 NOSE_TIP
、FOREHEAD_RIGHT
和 FOREHEAD_LEFT
区域组成。请勿更改这些骨骼的名称。
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-02-28。
[null,null,["最后更新时间 (UTC):2025-02-28。"],[[["Augmented Faces uses customized 3D models and 2D textures, created by artists and exported as FBX files, to overlay onto detected faces."],["ARCore provides canonical FBX and PSD files to aid in the creation of these assets, ensuring proper alignment with detected facial features."],["When exporting custom FBX files, ensure proper hierarchy, skinning, and bone naming to maintain compatibility with ARCore's runtime face mesh generation."],["The provided PSD file helps artists align 2D textures with facial features using layers for masks, guidelines, UVs, and background."]]],["Artists create custom 3D models and 2D textures in FBX and PSD formats for overlaying on detected face meshes. The SDK provides `canonical_face_mesh.fbx` and `.psd` files for guidance. The FBX file defines face mesh topology and facial regions; `.psd` guides texture alignment with features, using layers for masks, lines, UVs, and background. When exporting custom FBX files, ensure custom meshes are skinned to specified bones and follow the outlined hierarchy, excluding the reference `facemesh`.\n"]]