hello you can help me ? me need base tutorial or source for skinning animation on vertex shader or help me fix me source
i have same source on openGL 2.0 ((((( me need on openGL es 2.0
code:
//
// GLSL vertex shader for skeletal animation
//
#define N 100
#define EPS 0.001
uniform vec4 boneQuat [N];
uniform vec4 bonePos [N];
//
// Quaternion multiplication
//
vec4 quatMul ( in vec4 q1, in vec4 q2 )
{
vec3 im = q1.w * q2.xyz + q1.xyz * q2.w + cross ( q1.xyz, q2.xyz );
vec4 dt = q1 * q2;
float re = dot ( dt, vec4 ( -1.0, -1.0, -1.0, 1.0 ) );
return vec4 ( im, re );
}
//
// vector rotation via quaternion
//
vec4 quatRotate ( in vec3 p, in vec4 q )
{
vec4 temp = quatMul ( q, vec4 ( p, 0.0 ) );
return quatMul ( temp, vec4 ( -q.x, -q.y, -q.z, q.w ) );
}
vec3 boneTransf ( int index, vec3 pos )
{
return bonePos [index].xyz + quatRotate ( pos, boneQuat [index] ).xyz;
}
void main ()
{
vec4 weights = gl_MultiTexCoord3; // weights for 4 bones
vec3 pos = vec3 ( 0.0 );
int index;
if ( weights.x > EPS ) // process 1st bone
{ // get 1st bone index
index = int ( gl_MultiTexCoord4.w );
pos += weights.x * boneTransf ( index, gl_MultiTexCoord4.xyz );
}
if ( weights.y > EPS ) // process 2nd bone
{ // get 2nd bone index
index = int ( gl_MultiTexCoord5.w );
pos += weights.y * boneTransf ( index, gl_MultiTexCoord5.xyz );
}
if ( weights.z > EPS ) // process 3rd bone
{ // get 3rd bone index
index = int ( gl_MultiTexCoord6.w );
pos += weights.z * boneTransf ( index, gl_MultiTexCoord6.xyz );
}
if ( weights.w > EPS ) // process 4th bone
{ // get 4th bone index
index = int ( gl_MultiTexCoord7.w );
pos += weights.w * boneTransf ( index, gl_MultiTexCoord7.xyz );
}
gl_Position = gl_ModelViewProjectionMatrix * vec4 ( pos, 1.0 );
gl_TexCoord [0] = gl_MultiTexCoord0;
}
i see demos gremlin ( openGL es 2.0 ) if you use shaders for skinning animation in gremlin pleeeaaas give me source !
fnks for you support !idarkstranger2009-06-23 10:29:16