Sign in to follow this  
akuda

Skeletal Animations - the technique

Recommended Posts

Hi, Recently I've been trying to learn about skeletal animation. I understand the basics, and of course do not understand the quaternions :)... (ok, actually, I didn't even tried - most of the tutorials focuses only on the usage, and do not cover the proper mathematical derivations of 'em) While writing an exporter to Milkshape, I've noticed, that in some models a single point can be attached to more than one bone, with some "weights", which complicated a bit my idea. I wanted to take an advantage of VBO (I write in OpenGL), writing some kind of ResourceManager, that keeps static geometry in VRAM, and uses it unmodified after applying an interpolated bone transformation. When a triangle consist points attached to different bones, my idea doesn't work - correct me if I'm wrong, but it seems to be impossible to render a triangle, pushing two of it's point with one transformation matrix (MODELVIEW here), and the third using the modified matrix. Furthermore, even if it would be possible, still, how to apply these "weights"? My question is: How the professionals do it? When the transformations are applied, and what exactly is being stored in VRAM. I couldn't believe, that every non-static model is being sent to graphics hardware in every frame. At the moment, I've implemented my idea (static geometry, dynamic matrices). It seems to be efficient for some applications (for example, I believe that in BioWare's "Neverwinter Nights", there is no between-bones triangles at all - characters looks like dolls made of solid materials). But if (for example) I would like to apply some special effects, like breathing (example: Gothic 2), the multi-bones triangles seems to be a very nice solution. So the second question is: How hard the idea is to 1) understand and 2) implement. I've done a lot of coding in C++, and am not afraid of maths, or complicated algorithms. Thanks in advance for all the answers.

Share this post


Link to post
Share on other sites
Well I did the skeletal animation system for the DS a while ago. From what I can remember, you have the skin (vertices, texture coordinates, normals) this information can be in vram. Then you have the bone hierarchy. Each frame you want to compute the transformation for each bones (i.e combine with transformation with parent bones). So each bone have the transformation, then you will apply the transformation to all the vertices. Note that we need information which vertex belong to which bone. While doing this you are performing in bone space. Once that is done, then you can apply other transformation to position your objects in world space.

Share this post


Link to post
Share on other sites
Quote:
Original post by akuda
When a triangle consist points attached to different bones, my idea doesn't work - correct me if I'm wrong, but it seems to be impossible to render a triangle, pushing two of it's point with one transformation matrix (MODELVIEW here), and the third using the modified matrix. Furthermore, even if it would be possible, still, how to apply these "weights"?


Think of it this way: Your static geometry is just a collection of vertices (your vertex buffer). Each vertex is linked to one or more bones with associated weights.

Each frame, you calculate the transform for each bone from the animation data (lets call it boneMatrix). For each vertex, you simply multiply the vertex position with the bone transform and then multiply with the associated weight (boneMatrix.Transform(vertex.position) * weight). Since there can be more than one bone attaced to a vertex, you repeat the process for each bone linked to the vertex (a cumulative process). Each vertex will now be transformed differently according to how much a bone influenced it. The updated vertex buffer can now be pushed to the rendering pipeline.

HTH.

Share this post


Link to post
Share on other sites
Usually matrix palette skinning (hardware permitting).
Basically you have the static model (including vertices and bone weights) in VRAM (VBO in ogl, vertex buffer in d3d). You upload the bone matrices each frame (in vertex shader constants) and apply the skinning transform in a vertex shader as described by mobby6.

Share this post


Link to post
Share on other sites
ok, sounds logic to me... thanks for your answers.

Could anyone share some links (tutorials)?
I'm yet totally unfamiliar with vertex shaders.
Where to start?

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this