0

I'm writing a program that will load an animation from a file using assimp. According to this answer "The transform we use for skinning is (B_keyframe * offsetMatrix), where B_keyframe is the global transformation of a bone at some target location, provided e.g. by an animation clip." so... offsetMatrix is the inverse of the global transformation of a bone which would be computed by multiplying by the mTransform of the parent all the way up to the root aiNode.

But what use is mTransform then if the mesh is already in bind pose when I load it in?

For example, lets say a cube is parented to a sphere. The root aiNode has the sphere's transform, and the child aiNode has the cube's mTransform. If I were to edit this in blender and change say the scale of the sphere would that change the vertices in the aiMesh struct? Or just the sphere's mTransform? How would I render the cube in my program? Would I multiply the mTransform of the sphere with the cube's mTransform? Or has the scale already been applied to the vertices of the aiMesh belonging to the cube?

SGriffeth
  • 37
  • 6

1 Answers1

1

The transformation matrix, which is assigned to the node describes the relative position to the parent node of the node itself. If the node does not have any parent node this transformation describes the position of the scene in its model space.

The Offset matrix describes the bindpose of the child relavice to its root of the whole scene.

So if you want to place the cube you will use its transformation matrix. This will not change the vertices of the assigned meshes. It will transform it into your global model space of your scene.

In other words: the transformations will descripe te position of the object. The offset matrix will describe the maximum animation and the transformation matrix was already tokk into account.

KimKulling
  • 2,654
  • 1
  • 15
  • 26
  • So mTransform and the offset matrix, unlike the mvp matrix, only affect the position, not the scale and the rotation of the object? – SGriffeth Jun 09 '23 at 20:06
  • Scale and roration will be part of mTransform, for sure. – KimKulling Jun 11 '23 at 16:11
  • so when I use, for example, the scaling key of an aiNodeAnim to animate an object I'd need to interpolate the mValue of the mScalingKey and multiply it by the mTransform of the node? – SGriffeth Jun 11 '23 at 16:57