Skinning and Bones Offset

Hi together,



I'm working on a skeletal-animation framework at the moment. Everything works

fine, except I cannot move a bone without distorting my skin "before" I add

the bone-influences to the mesh.



Bone upperBodyBone = new Bone("UpperBodyBone");
            
mySkin.setSkeleton(upperBodyBone);
mySkin.setSkin((Geometry) pObjSpatial);      

int[] upperBodySkinIndizes = calculateSkinVerts(pObjSpatial, myBvhReader.getSkeleton().getSkeletonData().getAllVertices());
int[] headSkinIndizes = calculateSkinVerts(pObjSpatial, myBvhReader.getSkeleton().getSkeletonData().getHeadVertices());
int[] neckSkinIndizes = calculateSkinVerts(pObjSpatial, myBvhReader.getSkeleton().getSkeletonData().getNeckVertices());
      
makeSkinFromMesh(mySkin, upperBodySkinIndizes, null, upperBodyBone);

Bone neckBone = new Bone("NeckBone");
float[] neckJoint = myBvhReader.getNeckJoint();
neckBone.setLocalTranslation(neckJoint[0], neckJoint[1], neckJoint[2]);
makeSkinFromMesh(mySkin, neckSkinIndizes, null, neckBone);
      
Bone headBone = new Bone("HeadBone");
float[] headJoint = myBvhReader.getHeadJoint();
headBone.setLocalTranslation(headJoint[0], headJoint[1], headJoint[2]);
makeSkinFromMesh(mySkin, headSkinIndizes, null, headBone);
      
neckBone.attachChild(headBone);
      
upperBodyBone.attachChild(neckBone);



The upperBodyBone influences all Vertices in the Mesh. neckBone and headBone
have their own influences. Why does headBone deform the Mesh after
headBone.setLocalTranslation(... ); without having influences in the mesh yet?
Is there a possibilty to move Bones in a already skinned mesh, without influencing
the mesh itself?

I attached an image to show what my problem is.



Looks exactly like the problems I described over here:

http://www.jmonkeyengine.com/jmeforum/index.php?topic=6277

No solution or dev statement regarding the weird vertex offsets so far :’(

Would this be a result of the bind matrix being made for the bones at their original location?

Thank you for your replies, I found a temporal workaround which seems to be very “quick and dirty”. One of the problems seems to be, that the shoulder-bones have no Vertices assigned. Because I don’t use them actually, I assign all vertices of the mesh to it, and the problem with the neck is gone.



Nevertheless, the feet are still to long, so I create a helper bone which has the exact opposite value of the “Neck”-Bone and also assign him all Vertices. This results in a more correct interpretation. As I wrote, it is quick and dirty, if anyone finds a problem with the help of this new information … now that would be cool :slight_smile:







@renanse: Sorry, but I don’t really know what the bind matrix does or is, I don’t use one directly (maybe indirectly). Is that the index-values of the vertices of geometry-batch?



Another question, if I have the following Bone-Structure:

Bone -> Bone2 -> Bone3



Do I have to give Bone2 also the Vertex-Information of Bone3, or is it sufficient to give Bone2 and Bone3 their own Vertices?