Hello.
I try to animate a model using RigTransformHardware.
The comments in createVertexAttribList() of RigTransformHardware.cpp say:
// create vertex attribute by 2 bones
// vec4(boneIndex0, weight0, boneIndex1, weight1)
// if more bones are needed then other attributes are created
// vec4(boneIndex2, weight2, boneIndex3, weight3)
// the idea is to use this format to have a granularity smaller
// than the 4 bones using two vertex attributes
(in each attribute, 2 bones are stored)
Nevertheless, skinning.vert doest appear to use attributes with the right way.
Here is the computeAcummulatedNormalAndPosition function in
skinning.vert as used in osganimationhardware example.
void computeAcummulatedNormalAndPosition(vec4 boneWeight)
{
int matrixIndex;
float matrixWeight;
for (int i = 0; i < 2; i++)
{
matrixIndex = int(boneWeight[0]);
matrixWeight = boneWeight[1];
mat4 matrix = matrixPalette[matrixIndex];
// correct for normal if no scale in bone
mat3 matrixNormal = mat3(matrix);
position += matrixWeight * (matrix * gl_Vertex );
normal += matrixWeight * (matrixNormal * gl_Normal );
boneWeight = boneWeight.zwxy;
}
}
The first thing i notice is that the variable i in for loop isnt used
anywhere. But it seems the first 2 lines in this for loop should be
matrixIndex = int(boneWeight[ i + 0 ]);
matrixWeight = boneWeight[ i + 1 ];
The point is the first case works and the second doesnt.
In the end i use the first case, but i thought i should mention it.
thnx.
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org