Adding face animations to code and GPU shaders
Morph target animation data is stored in two places in an Assimp model file.
The first part of the morph animation data, the meshes, reside in the mAnimMeshes
array of an aiMesh
node, and the number of meshes is stored in the mNumAnimMeshes
variable of the aiMesh
. Every element of the mAnimMeshes
array contains the exact same number of vertices as the original mesh, allowing us to interpolate the vertex positions between different versions of the mesh.
This interpolation is not limited to blending between the original mesh and one of the morph target meshes. Also, blending between two morph target meshes is possible, or mixing positions of more than two meshes. Be aware that the outcome of mixing meshes may not always be as expected as the effect of the morph target animations heavily depends on the intention of the animator.
The second part of the morph animation data, the keyframe data, is in the mMorphMeshChannels
array...