Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to implement joints and bones in openGL?

Tags:

opengl

I am in the process of rolling my own openGL framework, and know how to draw 3d objects ... etc...

But how do you define relationships between 3d objects that may have a joint? Or how do you define the 3d object as being a "bone"? Are there any good resources?

like image 639
chutsu Avatar asked Dec 25 '12 13:12

chutsu


1 Answers

As OpenGL is only a graphics library and not a 3D modeling framework the task of defining and using "bones" falls onto you.

There are different ways of actually implementing it, but the general idea is:

You treat each part of your model as a bone (e.g. head, torso, lower legs, upper legs, etc).
Each bone has a parent which it is connected to (e.g. the parent of the lower left leg is the upper left leg).
Thus each bone has a number of children.

enter image description here

Now you define each bone's position as a relative position to the parent bone. When displaying a bone you now multiply it's relative position with the parent bone's relative position to get the absolute position.

To visualize:
Think of it as a doll. When you grab the doll's arm and move it around, the relative position (and rotation) of the hand won't change. Its absolute position WILL change because you've moved one of its parents around.

When tried skeletal animations I learnt most of it from this link: http://content.gpwiki.org/index.php/OpenGL:Tutorials:Basic_Bones_System

like image 186
s3rius Avatar answered Sep 21 '22 15:09

s3rius