I have come to that point in time where I need to implement Animation blending. And I need help to clearify the process.
Right now I am skinning on the GPU. When my character is drawn the vertices gets transformed by weighted bone matrices in the vertex shader. At the moment my character is in the default T-Pose. Before drawing, each bone is multiplied by the parent(top-to-bottom) on the CPU and the entire combined skeleton is passed to the GPU. So all of that is in place. All that remains is to animate these T-Pose matrices, which I need help to do.
It is clear to me that I need to animate the bones before combining them to the final skeleton which is passed to the GPU.
I have an array of bones (D3DXMATRIX) in T-Pose which is not combined. I can animate ontop of the T-Pose by multiplying each bone (in T-Pose) with an animation key(matrix retrieved from a Quaternion). If I then combine the bones to the final skeleton and pass it to the GPU I get a pose at that exact animation key.
To blend between two animation keys I use the D3DXQuaternionSlerp function on two animation keys(only the Quaternion part of the key). The animation track(keys) are stored in structs as 'Quaternions, Vec3 Position and Vec3 Scale'. From the result I extract the D3DXMATRIX and apply it to the appropiate T-Pose bone. When all bones are animated I can combine them and pass the skeleton to the GPU and render.
All this is good for One Animation track. But I want to Blend several animations. Now how do I do this? I which order do I blend the different tracks? Does it matter?
Say I have 3 Animation Tracks I want to blend. I will use the D3DXQuaternionSlerp three times, for two keys in each aniamtion track. Now I have 3 Quaternions (one from each track), what should I do with these to get the D3DXMATRIX to apply to my T-Pose bone? And how do I weight them?
Edited by Tispe, 09 July 2013 - 04:02 AM.