i have been succesful in animating a mesh with skeletal animation (joint based skeleton). the process was simple and straighforward:
- produce the absolute matrix for each joint by concatenating the joint’s poarent’s absolute matrix with the joint’s relative matrix
- for each vert in the mesh, translate it into joint-space for whatever joint it is associated with
- each time through the loop, transform the vert by it’s joint’s matrix.
this worked great. now i want to implement vertex skinning. my first thought is that putting the vert into joint-space won’t work, because the vert could be associated with more than one joint. i just can’t get my head around how to create the correct matrices and how exactly to transform the verts. i know i need to take the joint’s position into account when transforming the vert. i’m just not sure exactly how to do it.
i’d appreciate any input you guru’s may have</brownnosing>
The idea of skinning is pretty simple. Normally, when you change the position of a bone in your model, all the points in the “skin” go with it. It’s how we draw a model in the first place. The idea of skinning is to add a finer degree of controll in moving this skin with the bone. From a vertex point of view, it’s how much I’m influenced by my bone. From the bone’s perspective, it’s how much do I influence the vertices in my skin. This “how much” is quantified as “weight”. By associating a weight with eighter the bone, or vertices, you can calculate the degree to which the skin will deform in responce to a change in basis. With multiple bones sharing a joint, the change is a sum over all infuencing bones. In CG, for example, you would send bone weights, as you are streaming vertices. There is a CG example of this at nVidia’s web site if you would like to see code.
thanks for the response!
i actually have a good graps of the theory behind vertex skinning. my issue was how exactly to transform the verts. i have found a good reference of this from the gamedev magazine at http://www.darwin3d.com/gamedev.htm under 1998. basically the algorithm does this:
- subtract the joints position from the vertex (this puts the vert into joint-space as opposed to model space)
- multiply the vert by the joints matrix
- add the joints position back to the vert (puts the vert back in model-space)
- multiply the weight
these steps are performed on every weight for each vertex. i’ve got this working now in my code, but i have a small problem elsewhere. too late to investigate it tonight, though. back on it tomoree
After calculating the asbolute and ‘final’ transformation matrices for the joint, you can transform the vertices using weight values (all must add up to 1):
- Transform vertex into joint space (can be pre-calculated, or done at render-time)
Vector3 v = vertex.bindLocation;
- Transform vertex by joint ‘final’ transformation
- Apply weight value to transformation
v += ((v-vertex.bindLocation) * weight);
I was just about finished with my QuakeIIIArena modeler when I read your post about a vertex shader for skinning.
QuakeIIIArena does implement a simple form of skeletal animation system (bones & joint sort).
The transformation from the frames is based on key-frame animation and a SLERP equation.
I’d really like to implement skinning to my program, so Im just curios if you think it is possible to do this with this kind of models (I’m not to great with animation systems, this is my first real attempt) ?
Thankfull for any help,