Sign in to follow this  

[SOLVED] Dual Quaternion Issue

Recommended Posts

Hi guys!

After several hours of debugging i decided to ask you for help ^^
I´ve implemented skeletal animation with dual quaternions in my engine, but it looks like something in the blending process is still wrong.

this is how it should look, beautiful, isn´t it?

and this is how it actually looks like in my engine.
you can see the bones drawn as black lines, the squares indicate joints.

detail, at a lower angle

here is my vertexshader, calculating the blending. as you can see, i split up the dual quaternion in rotation- and translationpart. both are calculated in the engine. the bonePos is just the joint position. i checked the uniform values, everything is fine.

[code]#version 120

// (C) Zacharias :-P

attribute vec4 weights1;
attribute vec4 gl_MultiTexCoord0;
uniform vec3 bonePos[4];
uniform vec4 boneDQuatR[4];
uniform vec4 boneDQuatT[4];

vec3 calculateBlendPosition(vec3 position, vec4 blendDQR, vec4 blendDQT)
//blendDQR /= length(blendDQR);
vec3 blendPosition = position + 2.0*cross(, cross(, position) + blendDQR.w*position);
vec3 trans = 2.0*(blendDQR.w* - blendDQT.w* + cross(,;
blendPosition += trans;
return blendPosition;
void main(void)
// just pass the texture for now
gl_TexCoord[0] = gl_MultiTexCoord0;
// skinning
vec4 v4 = gl_ModelViewMatrix * gl_Vertex;
vec3 v =;

// x y z w
vec4 r = vec4(0.0,0.0,0.0,0.0);
vec4 t = vec4(0.0,0.0,0.0,1.0);

for(int i=0;i<4;i++)
v -= bonePos[i]*weights1[i];
r += boneDQuatR[i]*weights1[i];
t += boneDQuatT[i]*weights1[i];

v = calculateBlendPosition(v, r, t);
for(int i=0;i<4;i++)
v += bonePos[i]*weights1[i];

gl_Position = gl_ProjectionMatrix * vec4(v, 1.0);

i tried out several things like normalizing etc, but everything seems to be fine.
btw the blending gets better at the 2nd joint, but is still wrong.


Share this post

Link to post
Share on other sites
Solved. Rotation centers should be implemented while creating the quats, not in the shader by offset. The weighting of offsets causes those artefacts.

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this