Skinning with dual quaternions
In this section, you will learn how to modify the skinning algorithm so that it works with dual quaternions instead of matrices. Specifically, you will replace the skin matrix with a skin dual quaternion that will transform both the vertex position and normal position.
The problem dual quaternions solve is the linear blending of matrices, which is currently implemented in a vertex shader. Specifically, this is the bit of code that introduces the skinning artifacts:
mat4 skin; skin = (pose[joints.x] * invBindPose[joints.x]) * weights.x; skin += (pose[joints.y] * invBindPose[joints.y]) * weights.y; skin += (pose[joints.z] * invBindPose[joints.z]) * weights.z; skin += (pose[joints.w] * invBindPose[joints.w]) * weights.w;
There are three stages in the animation pipeline where it makes sense to replace matrices with dual quaternions. Each of these will have the same result. The three places where this should be implemented are listed here...