Interpolating Animations using SkinMatrix

Ive been using unity Graphics Skin Matrix and Blob Array to achieve mesh deformation at runtime. However when trying to blend to poses i couldnt figure out how to interpolate two matricies without causing artifacts.

Ive read that the way to go is to destruct the matricies and lerp the translation and slerp the rotation components and then reform however this doesnt work.

                for (int j = 0; j < bones; j++)
                {
                    var trans0 = m0[j];
                    var trans1 = m1[j];
                   
                    var rotMat = new float3x3(Quaternion.Slerp(trans0.rotation, trans1.rotation, animation.weight));

                    renderer.ElementAt(j).Value = new float3x4(
                        rotMat.c0,
                        rotMat.c1,
                        rotMat.c2,
                        math.lerp(trans0.position, trans1.position, animation.weight));
                }

this ofcourse works at weights 0 and 1 but fails otherwise.

I didnt find much info on the skinMatrix topic and i wanted to be sure this i a bad idea before moving on to other animation options.

Do not store matrices in BlobAssets. Store rotatation quaternion and position separately and make skin matrix after interpolation of those values.

Thanks for the reply.
From my understanding thats exactly what im doing, as shown in the code snippet

Sorry, I was careless. I thought that trans0/1 has SkinMatrix type and you are doing double quaternion->matrix->quaternion conversion. It is hard to give you any practical advice by looking on your code, because Rukhanka Animation System is working by similar way (and blending is ok).

Here’s what you need:

  1. You need to blend your local space transforms. That is weighted average for position and scale, and weighted nlerp for rotations.
  2. You need to transform your local transforms into root space. That requires knowing the hierarchy.
  3. You need to multiply the root-space matrix with the corresponding bone’s bindpose which is stored in the Mesh. That’s what then becomes the Skin Matrix.

Not having the bindpose baked in and instead applying it at runtime after blending worked. Thanks big help