变形动画

简介

变形动画(也称顶点动画)是模拟软材质变形的一种方法。它能将一个形状平滑地转换成另一个形状。具体方法是创建一个网格,网格中的每个顶点都包含多个位置。每组额外的位置定义了一个形状,称为morph target 。动画时,会为每个目标分配一个weight 。每个顶点的有效位置是根据权重在目标位置之间进行线性插值计算得出的。

变形不同于骨骼动画,在骨骼动画中,我们创建一个想象的骨骼,并通过定义模型的每个顶点与骨骼节点之间的关系来装配模型。

请注意,每个变形目标的基本结构必须相同:如果三个顶点在基本模型中构成一个三角形,那么它们在所有变形目标中也将构成一个三角形。这个三角形可以有完全不同的位置、方向和大小;甚至可以通过使其成为大小为零的退化三角形来有效地去除它。

在大多数情况下,网格将由外部工具创建,并使用Balsam资产导入工具导入。例如,在 Blender 3D 编辑器中,变形目标被称为 "形状键",而在 Autodesk Maya 中,它们被称为 "混合形状"。

变形示例展示了如何控制从 Blender 导入的模型的权重。

自定义变形动画示例展示了如何通过子类化QQuick3DGeometry 在 C++ 中创建变形目标。

© 2025 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.