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?
[attachment=7379:1.jpg]
and this is how it actually looks like in my engine.
[attachment=7380:2.jpg]
you can see the bones drawn as black lines, the squares indicate joints.
detail, at a lower angle
[attachment=7381:3.jpg]
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.
THX
Zachy