Is this quaternion multiplication or slerp?
D3DXQUATERNION q_t_pose = GetTPoseQuaternion(BoneID);
D3DXQUATERNION q1 = GetQuaternionFromAnimation(Walking, BoneID, time);
D3DXQUATERNION q2 = GetQuaternionFromAnimation(Shooting, BoneID, time);
D3DXQUATERNION q3 = GetQuaternionFromAnimation(Hit, BoneID, time);
D3DXQUATERNION qFinal = q3 * q2 * q1 * q_t_pose;
//Combine all BoneMatrices to a final skeleton for use for skinning vertices
This is quaternion mutiplication. Actaully this means that first you rotate your object with q_t_pose then with q1 next q2 and q3 respectively. This can be used for additive animation bledning but is not suitable for mixing animations.
So, is this how I should Animate characters?
1. Build T-Pose bones in Dual Quaternion form.
2. Create a list of animation tracks to blend and set a weight for each track.
3. For each bone, enter every animation track and get the Bone Quaternion at time t by Slerp(key1, key2, t'), convert it to Dual Quaternion, weight it and add it to T-Pose bone.
4. Combine all T-Pose bones which are now animated and send the skeleton to the GPU.
This procedure is OK as far as you normalize the weights. For the dual quaternions i have to say that i've never used it and know a little about it. I always use quaternions and it responds very well for rotations on CPU. I think you can use them at least in CPU computations. I have no idea about GPU computations.
I found an article describing "nlerp" http://number-none.com/product/Understanding%20Slerp,%20Then%20Not%20Using%20It/ . Supposedly it is more CPU friendly than Slerp and supposedly it is commutative, meaning I can blend the animation tracks in any order with the same results. Anyone here have experience with nlerp?
I have worked with nlerp before. I prefer to use nlerp when i want the animation LOD to be low. nlerp takes less computation. It can be calculated like this:
nlerp(q1, q2, t) = normalise( (1-t) * q1 + t * q2 );