# Dual Quaternion Skeletal Animation

I’m having a small but annoying problem with implementing skeletal animation using Dual Quaternions. The idea is to do the bone interpolation CPU side and to do the skinning on the GPU using boneID’s and Weights.

My current Test Case

2 Bones. Bone 0 = Parent , Bone 1 = Child

Keyframe 0 (Bind Pose)
Bone 0 : Head at (0.0, 0.0, 0.0) , Tail at (2.0, 0.0, 0.0) (Z is up)
Bone 1 : Head at (2.0, 0.0, 0.0) , Tail at (4.0, 0.0, 0.0)

Keyframe 1
Bone 0 : 90 degree rotation around the Y-Axis (Locally)
Bone 1 : 45 degree rotation around the Y-Axis (Locally)

## The idea here is that at the end of the interpolation Bone 1’s head, having been rotated by Bone 0, will be at (0.0, 2.0, 0.0) and the tail will have a further 45° rotation putting it at around (-1.414, 3.414, 0.0)

The problem I’m having is that I can’t seem to get the Head for Bone 1 to stay connected to the Tail of Bone 0. I can get each bone to rotate properly, i.e. Bone 1 has the combined 135° degree rotation in the end, but its position isn’t right.

Bone 0 = Green , Bone 1 = Yellow

For some reason this forum isn’t letting me link the image I made describing my situation so here’s a plain text link.

(insert ĥttp://) imageshack.us/a/img62/7913/t77m.jpg

Here’s my current process :

1. Start at Parent (Bone 0), Interpolate between Keyframe 0 and 1 using TimeDelta -> Makes New ParentDQ
2. Send new ParentDQ to Child (Bone 1)
3a. Interpolate Child between Keyframe 0 and 1 using TimeDelta -> Makes new ChildDQ
3b. Multiply new ChildDQ by new ParentDQ -> Adds parent rotation to child bone.
3c. Multiply updated ChildDQ by ChildInverseDQ -> Moves child bone into its position??

ChildInverseDQ is a DualQuat created by negating the bind pose starting position.

ChildInverseDQ = .5 ( t r )
: t = (2.0,0.0,0.0,0.0) , which is the bones head position
r = (0.0,0.0,0.0,1.0), identity quat

``````                     =  q_real (0.0,0.0,0.0,1.0) &lt;- (x,y,z,w)
q_dual(-1.0,0.0,0.0,0.0) &lt;- (x,y,z,w)
``````

What I’m doing is obviously not working for me, but is the theory sound? How far off am I?

Doesn’t sound right. This should be the full inverse of the bind pose transform for the specified joint (rotation and translation). For the root joint this might just be a negative translation (i.e. 0 deg rotation), but for child joints in general, this is not the case.

What I’m doing is obviously not working for me, but is the theory sound? How far off am I?

Sounds like you’re close. If trouble persists, would just do your transform compositing using matrices, and then just do a matToDQ on the tail end. Then later you can flip to DQs.