Sign in to follow this  

Seeking guidance - character animation

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

Hi, I'm working on a project of mine which is a simple 3d game using SDL, and I'm now at the stage where I want to put some life into the game. Currently,all I have implemented in my engine is loading of .obj files,third person camera,frustum culling and depth sorting,pretty much basic stuff to let you view a 3d world normally. As for animation, I'm looking for something which will fit my engine, although skeletal animation would be amazing, I think I better start with the basics. I want a character to have walk,stand,attack animations and I was wondering if theres a simple way of implementing that, that is, not by using skeletal animation. I've been searching and reading stuff on the subject over the past few days and did not make much progress. I was hoping someone could point me to something that'll fit my engine in simplicity. Any suggestions are welcome, please consider time is a factor and that currently I don't have texture support. Thanks in advance.

Share this post


Link to post
Share on other sites
If you don't want to use skeletal animation, you can keyframe your model vertices. Basically you swap out one vertex set for another, while using the same index buffer to stretch the polygons over those vertices.

It costs you having each frame of each animation worth of vertices in memory, to the point it is probably worth it to page the current animation's vertices into a vertex buffer. Using a vertex shader to interpolate between frames has been a common practice since programmable pipelines became mainstream.

As far as animation control, if you want high-quality animation, use a state-machine that combines input with current animation, and instructs what the next animation to use is at the end of each one. This is how the highly varied animation in games like Prince of Persia is accomplished; Sands of Time had over 200 animation fragments, if I remember right, none of them longer than a quarter of a second long, augmented by a simple kinematics system to make the Prince's feet interact with varying floor levels and slopes. I would conjecture that they also use a basic interpolation when the prince gets struck or thrown, to tween from the current animation to an impacted or thrown pose.

Share this post


Link to post
Share on other sites
Quote:
Original post by Wyrframe
If you don't want to use skeletal animation, you can keyframe your model vertices. Basically you swap out one vertex set for another, while using the same index buffer to stretch the polygons over those vertices.

It costs you having each frame of each animation worth of vertices in memory, to the point it is probably worth it to page the current animation's vertices into a vertex buffer. Using a vertex shader to interpolate between frames has been a common practice since programmable pipelines became mainstream.

As far as animation control, if you want high-quality animation, use a state-machine that combines input with current animation, and instructs what the next animation to use is at the end of each one. This is how the highly varied animation in games like Prince of Persia is accomplished; Sands of Time had over 200 animation fragments, if I remember right, none of them longer than a quarter of a second long, augmented by a simple kinematics system to make the Prince's feet interact with varying floor levels and slopes. I would conjecture that they also use a basic interpolation when the prince gets struck or thrown, to tween from the current animation to an impacted or thrown pose.


This is a highly complex solution and I don't recommend it to a beginner.

Try taking a pre-existing system. For keyframe animation, look to the MD2 file format. This is old technology, but simple to get running. It has 199 keyframes which you then use to blend between two frames using linear interpolation. The results can be of a very high quality, but this does not lend itself to ragdoll animation.

Alternatively, you could go with skeletal animation, in the form of Cal3D. I currently have a md2 system working from code somebody gave me, although of course I cannot distribute this, so I am replacing it with cal3d animation. Cal3d is an open source skeletal animation system, with exporters from most character modelling software.

Share this post


Link to post
Share on other sites
Thanks for your reply.

I think I didn't phrase myself correctly, it's not that I don't want to use skeletal animation, I mainly want to keep things at their simple level.
I'm not looking for high-quality animations, heck I'd be happy with having a stickman running around with cubes as hands and legs and spheres as joints and head. I wouldnt mind if he would slide on the floor either.
Keyframing does sound like an option, but I need to know more on both options.

Can you please expand on basic skeletal animation or reffer me to a good article?
Or better yet a documented character animation library?
Also,if you could point me to a format which will suite my needs that'd be awesome.

Thanks in advance.

EDIT: Didn't want to double post. Thanks for the info species, I'll check out cal3d and MD2.

Share this post


Link to post
Share on other sites
I am at same point as you and skeletal animation is a way to go.

You can begin with skindemo in directx samples as a starting point. But don't digg to deep into that sample, before you have red this article:

http://www.flipcode.com/archives/Modular_D3D_SkinnedMesh-Towards_A_Better_Modularity_Within_The_D3D_SkinnedMesh_Sample.shtml

Also take a look into cal3d, it is very competent character animation library designed to be used together with DirectX: https://gna.org/projects/cal3d/

I used it together with crystal space some 2 or 3 years ago, and it worked very well. If I wasn't about to learn topic of skeletal animation in detail myself, I would use it for my project as well.

For some reason they have moved to savannah; they used to have nice and easy navigated site before. But digg around, they have a lot of samples of how to program cal3d and how to connec to a modelling package.
------------ edit:

Hej sorry man, here it is again: http://home.gna.org/cal3d/ :)

Share this post


Link to post
Share on other sites

This topic is 3485 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this