Skeletal Animation

Started by
4 comments, last by Prozak 19 years, 10 months ago
I am adapting my engine for model animations, either by "Vertex Snapshots", in which the CPU/GPU interpolates between snapshots, or actually using Skeletal Animation (SA) (if there are more types of animations, please tell me about them). So, my main current interest is the Data Structures for SA. Let me define "Line", as the "bone", the support structure for the model, as 2 vertices in space. Im thinking that a model is divided into sections, each section is just a list of faces. Per section there is a "Line", that tells how that section of the model should morph. There should also be some information about "twisting", like, how you can twist your arm between your wrist and your elbow, right? This could be done by adding a "normal" vector on each one of the 2 vertices of the "line". Also, a line has 1 Parent, and none, 1, or multiple childs... * * * Now, regarding Physics, and lets use ragdolls as visual metaphores. Now, I have all these bones inside the model, animating him, telling the model how to morph, etc... Regarding physics and collisions, while alive, the whole model obeys the simple rules of the bounding box/sphere, but when he dies, (and here is where i need a few pointers) im thiking of creating collision spheres at the bone-joints, and creating some joints to limit angles of movement on some parts of the body (so that a knee doesnt turn thr wrong way, etc)... So, 3 Questions: - In an engine that works with SA, how do the data structures look like? - How to partially transfer the computational expense to the GPU? - How to implement physics with the SA system, how have others done it? I know this is a lenghty post, but any pointers on the subject are welcome Salsa cooked it, your eyes eat it![Hugo Ferreira][Positronic Dreams][Colibri 3D Engine][Entropy HL2 MOD][My DevDiary]
[Yann L.][Enginuity] [Penny Arcade] [MSDN][VS RoadMap][Humus][BSPs][UGP][NeHe]
"our stupidity allways comes back to bite us in the ass... in a white-shark sort of way..." - Prozak
Advertisement
First - How can you think of a bone as line ??
It''s actualy not the bone that you use to translate it''s the joint buth I don''t want to explain this now read on 3DS MAX or any other modeler''s help.

- In an engine that works with SA, how do the data structures look like?
    struct BoneKeyframe_Trans    {        float         Time;        Vector3       Translation;     };    struct BoneKeyframe_Rotation    {        float         Time;        Vector3       Rotation;    };    struct Bone    {        BoneKeyframe_Trans             Trans;        BoneKeyframe_Rotation          Rotat;                BoneKeyframe_Trans*            Keyf_Translation;        unsigned int                   nKeyf_Translation;        BoneKeyframe_Rotation*         Keyf_Rotation;        unsigned int                   nKeyf_Rotation;    };


- How to partially transfer the computational expense to the GPU?

Use vertex shaders to transform vertices acording to the bone - a lot of tutorials on this on the net. Google around

- How to implement physics with the SA system, how have others done it?

A huge topic and I don''t hawe the time right now (or the motivation Google around again
Red Drake
Thanks for the reply Red Drake.

How can i think of a bone as a line? Well, pretty obvious no? it connects two points... need i say more?....

"It''s actualy not the bone that you use to translate it''s the joint"

Yes, thats pretty obvious, but isnt the bone the rotation vector? I know the joints themselfs hold some data too (like, forbidden angles the limb cannot make)...

"A huge topic and I don''t hawe the time right now (or the motivation"
Why do you bore with an answer then... *sigh*

And pointing me to 3D modeling packages is useless, i dont expect them to dwelve on the intricacies of the programming implementation aproach, only its uses, where/how to use it (SA)....

Anyone has implemented any of this?

Salsa cooked it, your eyes eat it![Hugo Ferreira][Positronic Dreams][Colibri 3D Engine][Entropy HL2 MOD][My DevDiary]
[Yann L.][Enginuity] [Penny Arcade] [MSDN][VS RoadMap][Humus][BSPs][UGP][NeHe]
"...if you had one shot, one oportunity, to seize everything you ever wanted for one moment, would you capture it? or just let it slip?" - Eminem
quote:Original post by Prozak
Thanks for the reply Red Drake.

How can i think of a bone as a line? Well, pretty obvious no? it connects two points... need i say more?....

"It''s actualy not the bone that you use to translate it''s the joint"

Yes, thats pretty obvious, but isnt the bone the rotation vector? I know the joints themselfs hold some data too (like, forbidden angles the limb cannot make)...

"A huge topic and I don''t hawe the time right now (or the motivation"
Why do you bore with an answer then... *sigh*

And pointing me to 3D modeling packages is useless, i dont expect them to dwelve on the intricacies of the programming implementation aproach, only its uses, where/how to use it (SA)....

Anyone has implemented any of this?

Salsa cooked it, your eyes eat it![Hugo Ferreira][Positronic Dreams][Colibri 3D Engine][Entropy HL2 MOD][My DevDiary]
[Yann L.][Enginuity] [Penny Arcade] [MSDN][VS RoadMap][Humus][BSPs][UGP][NeHe]
"...if you had one shot, one oportunity, to seize everything you ever wanted for one moment, would you capture it? or just let it slip?" - Eminem



What I meant with "no time & motivation" is that I use 56k DialUp so i write short anwsers (any long ones woud bee preaty expenisive - especialy at my country )

If you want a tutorial on bones animation see the "Real Soon Now" in the links of the GameDev - it has a tutorial & example of loading MS3D.

And ybout the lines - you need only joints and other is calculated trough some preaty complex math - using quaterions.
Red Drake
I've implemented all of the above with custom vertex shaders and all, what Red Drake said is right.

I started off thinking a bone was a line too, you get over that after a while

[edited by - alfiare on June 9, 2004 10:02:40 AM]
For animation, you don''t need to work with bones, only the joints themselves. A joint''s position in relation to it''s parent joint will create the bone effect. 3D modellers simply draw a connection between joints, so you see the bones.

Let''s say you have the elbow and the wrist. The elbow is the wrist''s parent, of course, and each joint has it''s own local transform matrix. The wrist''s position is, then, relative to the elbow, so if you rotate the elbow, the wrist will rotate, as if there was a bone between them.

If all you''re doing is playing back animations exported from 3D packages, you don''t need angle range data, since the animations themselves will suffice. But you''ll need it if you want to blend real-time IK (and physics) with the animations.

This topic is closed to new replies.

Advertisement