Jump to content
  • Advertisement
Sign in to follow this  
i_luv_cplusplus

OpenGL Skeletal animation

This topic is 4430 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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)

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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 ???

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
you can do rotation interpolation using quaternions

Share this post


Link to post
Share on other sites
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... :|

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
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








Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!