目的
拾遗,备份
Blend Shape 逐顶点 多个混合思路
blend shape 基于: vertex number, vertex sn 相同,才能正常混合、播放
也就是 vertex buffer 的顶点数量一样,还有 triangles 的 index 要一致
这样 blend shape 才能逐个顶点计算
计算公式:使用一张大佬整理的图,大佬的文章:BlendShapes基础与拓展练习(面捕与物体变形)

Blender
Shift+A 新建一个 sphere

选中

Tab 进入 Editor Mode,并且在 Data 页签属性的 Shape Keys 添加对应的 blend shape 状态


调整好每一个 Shape Keys (或是叫:blend shape) 的顶点位置
然后再 Object Mode 下,我们可以选中对应的 Shape Keys 然后调整 value 查看变形结果

最终我们尝试 K帧动画来查看 多个 shape keys 混合控制的情况

3Ds max
interlude _1 : working on Yui-chan’s face morphing. - 3Ds max 中的演示 二次元 脸部表情 FFD
Unity 中使用
先在 blender 导出 fbx

将 fbx 模型拖拽到 hierarchy

尝试拖拉 inspector 中的 blend shape 拉杆,即可查看效果

所以我们写脚本控制 blend shape 混合拉杆即可达到我们各种表情的混合控制

在原来 blendshape_1 基础上在混合 blendshape_2

blendshape_1 和 blendshape_2 一起播放

然后可以尝试看一下 blendshape_1 和 blendshape_2 不同速率的控制混合的情况
这里使用 pingpong 算法

下面是测试 csharp 脚本
// jave.lin 2023/10/07 测试 blend shape
using System.Collections;
using UnityEngine;
public class TestingBlendShape : MonoBehaviour
{
public SkinnedMeshRenderer skinnedMeshRenderer;
private int _BlendShape_1_IDX = -1;
private int _BlendShape_2_IDX = -1;
private IEnumerator _couroutine_blendShape1;
private IEnumerator _couroutine_blendShape2;
private IEnumerator _couroutine_pingpong;
private void OnDestroy()
{
StopAllCoroutines</

本文介绍了如何在Blender、3Dsmax和Unity中使用BlendShape进行逐顶点混合,包括创建、编辑和通过脚本控制面部表情和物体变形的过程,以及C#脚本示例和性能优化方法。

1万+

被折叠的 条评论
为什么被折叠?



