Jump to content
  • Advertisement
Sign in to follow this  
spelltwister

OpenGL Skeleton Animation Help

This topic is 4375 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

Hey all, I've searched the forums for about 45 mins so far and it's helped me quite a bit, however I'm not quite sure where to go from here. I have been reading that sprites are setup with a skeleton then a model placed over it, then bound to the skeleton. When the skeleton is animated, the model animates the same way (hence the binding). If that incorrect please let me know. Only problem left is at what point do I do the animation of the skeleton? Does it happen in 3ds max then get ported into OpenGL? or does OpenGL have to do the animation? Any tutorials/references/books on this topic would be very appreciated. Thanks, Mike

Share this post


Link to post
Share on other sites
Advertisement
Check this out: http://nehe.gamedev.net/data/articles/article.asp?article=03
You need to animate the skeleton in a tool that supports skeletal animation and inverse kinematics.
I'm pretty sure 3DS Max does that. (I've never used it, though.)
Then you animate your model according to the skeleton in OpenGL.

Share this post


Link to post
Share on other sites
I haven't done skeletel animation in opengl but I have in directX. The way we did it was to create a model in a 3d modeling program and then create animation sets. our code then read in the model and animation sets which were then played. you can also go break down the model if it has a bone structure and manually manipulate it in the code. we found this to be extremely annoying and were not able to get it done correctly.

goto http://www.moon-labs.com/resources/d3dx_skinnedmesh.pdf

that is a very useful document. it explains it in directx but you should be able to translate it over i think.

Share this post


Link to post
Share on other sites
Thanks for the info guys, but I'm really, really new to this whole animation thing, so please bare with me.

Here's what I think you're supposed to do, please let me know if I'm wrong:

Create a skeleton in 3DS Max
Create a Model on top of that skeleton
Bind the skeleton so the model (don't know how to do that)
Animate the skeleton in 3DS Max

Import the information from 3DS Max to OpenGL and use the animation from the skeleton on the mesh (don't know how to do that).

Questions, does the binding happen in 3DS Max or OpenGL and does anyone know where I can find out how to port the animations in a useful way.

Thanks so much,

Mike

Share this post


Link to post
Share on other sites
Create your model (the mesh) in 3dStudio, or what ever modeling package you prefer. Since the .3ds file is fairly complex to read, I suggest you use Milkshape. There is a great tutorial on loading it over at Real Soon Now.

Assuming your are using Milkshape, you will create a skeleton that fits your model. Then you will assign each vertex of your mesh to a bone in that skeleton. When the bone rotates about it base, the vertex will rotate about the same point (image your elbow as this point, your forearm is a bone with lots of mesh points around it, all rotating about your elbow).

Save your model and write code to import it into your program (read the tutorial). Notice I said into your program, not into OpenGL. Unlike Direct X, OpenGL has no support or helper objects for animation. You must do it all in your code. Basicaly what happens is every frame, you calculate the time that has passed. Then you update your bone structure accordingly (from the animation keyframe data). When updating the bones you will create a matrix for each bone. Then each vertex that is associated with that bone is mulitplied by that matrix to reach the new position. You then render these new positions, and the model will be in a differnt position/shape.

So basicaly there are 4 structures: The 'Posed' Mesh, The Rendered Mesh, The Skeleton, The animation Data

The posed mesh is how you modeled the mesh, for example a human model may be positioned with its arms straight out.

The rendered mesh is like a duplicate copy of the above mesh, and each frame you do something like this:
Rendermesh.vertex(i).position = posedmesh.vertex(i).position * bones.matrix(posedmesh.vertex(i).boneid)

The skeleton is a hierarchy of bones, which essentialy are relational offsets from each other. Your wrist is 1 foot from your elbow, not 4 feet from the ground..

The animation data will consist of things called keyframes. Each keyframe will have a time signature and rotation data for each bone in the skeleton. This is where the actual animation takes place.

I hope this clarifys some things. Google search for any words you don't understand or I'll be glad to elaborate. Also the dictionary on this website should help define most of them.

Share this post


Link to post
Share on other sites
Hello,

First off, thank you very much for your help.

I think I'm going to have to see if our graphics guy can figure out Milkshape because there seems to be quite a bit more support for that.

However, if anyone knows of documentation on this process with 3DS Max, I would still like to compare the difficultly between the two. I was reading somewhere that typically you don't save the file as a .3ds, but as something more friendly, I don't remember exactly, but I'll have to continue my research.

Thanks again for you help!

Mike

Share this post


Link to post
Share on other sites
3D studio has a scripting language MAX Script. You could probably use that to export any of the scene information including the mesh, bones, and animation keyframes to a format of your creation.

I've tried importing the .3DS file before and it worked. But the tutorial I used didn't include information about animation. The .3ds file includes way more crap then you'll need for your game unless you want your game design to rely heavily on 3DStudio for things including lights, cameras, and object placement. Definately give Milkshape a look for simplicity.

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!