Jump to content
  • Advertisement
Sign in to follow this  

[SOLVED] Dual Quaternion Issue

This topic is 2335 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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.

#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(blendDQR.xyz, cross(blendDQR.xyz, position) + blendDQR.w*position);
vec3 trans = 2.0*(blendDQR.w*blendDQT.xyz - blendDQT.w*blendDQR.xyz + cross(blendDQR.xyz, blendDQT.xyz));
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 = v4.xyz;

// 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*weights1;
r += boneDQuatR*weights1;
t += boneDQuatT*weights1;

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

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
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!