Skeletal animation

Started by
6 comments, last by i_luv_cplusplus 17 years, 9 months ago
Lets say I have rotation matrix of every bone at each keyframe... I can interpolate it and stuff (slerp preferably), but I have no idea how to render the mesh and how to use this rotation info. Any ideas? (I use opengl)
OpenGL fanboy.
Advertisement
typically with a skeletal mesh, each vertex is assigned to a specific bone as an offset of that bone's position. to render you render each bone's vertices by applying the total transform of that bone and all it's parent bones. basically as you walk the hierarchy you multiply the matrices together so that when you arrive at each bone you get the total transform for that bone. fun with recursion! =)

-me
So:

lets say I have skeleton

1-2-3

1 is root bone, 2 is child of 1, 3 is child of 2

then:

child3rot_matrix_final = child3rot_matrix * child2rot_matrix * child1rot_matrix ???

OpenGL fanboy.
Do you have some links to skeletal animation source codes you could share? I know only rsn.gamedev.net but it is a bit too much milk-shape :S
OpenGL fanboy.
you can do rotation interpolation using quaternions
Yeah I know, I found many examples of quaternion interpolation and about bones (gpwiki) but I couldn't find many examples of actual mesh rendering process, when all rotation data is known... :|
OpenGL fanboy.
Quote:Yeah I know, I found many examples of quaternion interpolation and about bones (gpwiki) but I couldn't find many examples of actual mesh rendering process, when all rotation data is known... :|


"...when all rotation data is known... :|," i asume then that you CAN render the mesh in his original pose (the way it was originaly modeled), but you are just having problem on translating the original pose to the animated frame (the frame). The best way to draw this is using a vertex index buffer.

The mesh data is stored using a vertice array and an using a list of triangles, every triangle have 3 index to the vertice array, when you render all the triangles in the list then the resulting is the mesh in his original pose.

Now every vertice in the array also includes an info that tells you to which bone it belong, so after you know all the rotations/translations for all bones then you have to rotate/translate ALL THE VERTICES IN THE ARRAY using the transformation of the bone that they belong; when you are done now just draw the triangle list and the resulting will be themesh in his animation frame.

If you are using quaternions for rotating your bones, then you can convert your quaternion to a matrix then use that matrix for transform all vertices that belong to that bone.

Bone A --->Quaternion A ----->Matrix A,
transform all vertices in the array that belong to bone A using the matrix A.

Note. So far I know All transformation have to be applied to the vertices array in his original pose; so after doing the new transformation you need to found a way to get back the original data before appling the next frame animation.


good luck








So should I just put bone rotation to glrotate3f? :S
OpenGL fanboy.

This topic is closed to new replies.

Advertisement