Hello. I use the default RigTransformHardware for skinning on a dae Model with skeleton. My model consists of 4 RigGeometries (image 1). The number of bones per vertex is 7, 2, 20 and 15 respectively. After enabling the OSG_NOTIFY as INFO i see that it creates vec4 boneWeightX attributes based on the 4 previous numbers (num_of_bones/2).
The vertex shader i use for skinning is the following:
#version 120
attribute vec4 boneWeight0;
attribute vec4 boneWeight1;
attribute vec4 boneWeight2;
attribute vec4 boneWeight3;
uniform int nbBonesPerVertex;
uniform mat4 matrixPalette[MAX_MATRIX];
vec4 position;
void computeAcummulatedNormalAndPosition(vec4 boneWeight){
int matrixIndex = int(boneWeight[0]);
float matrixWeight = boneWeight[1] ;
mat4 matrix = matrixPalette[matrixIndex];
position += matrixWeight * (matrix * gl_Vertex );
}
void main( void ){
position = vec4(0.0,0.0,0.0,0.0);
if (nbBonesPerVertex > 0)
computeAcummulatedNormalAndPosition(boneWeight0);
if (nbBonesPerVertex > 2)
computeAcummulatedNormalAndPosition(boneWeight1);
if (nbBonesPerVertex > 4)
computeAcummulatedNormalAndPosition(boneWeight2);
if (nbBonesPerVertex > 6)
computeAcummulatedNormalAndPosition(boneWeight3);
gl_Position = gl_ModelViewProjectionMatrix * position;
}
The problem is that when i try to use all the boneWeight attributes it
creates (which are 10), the model breaks (image 2).
On the other hand the code above (with only 4 attributes) works like
the RigTransformSoftware.
On a different high detail model (which creates 25 bone weight
attributes max), i get the following results:
-With only the first 4 attributes: the model is broken and animated
-With all the attributes: the model is correct but there is no animtion.
Can anyone help me through this ?
Is this behavior normal?
I also get a lot of Warning: detected OpenGL error 'invalid value'
after RenderBin::draw()
Thank you for your time and sorry for the long post.
<<attachment: 4 attributes.png>>
<<attachment: 10 attributes.png>>
_______________________________________________ osg-users mailing list [email protected] http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

