Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Code Snippets / Animation Blending + Timer Based Animation

Author
Message
Cash Curtis II
18
Years of Service
User Offline
Joined: 8th Apr 2005
Location: Corpus Christi Texas
Posted: 11th Aug 2006 08:04 Edited at: 11th Aug 2006 08:14
There has been a lot of talk about this lately, so I thought I'd post an example of exactly how to do it.

This is animation blending, using interpolation. It is NOT combining animations. That is, animating the top half of a model as firing and the bottom as walking by combining different animations.

What this does is blend one animation smoothly to another. This allows your model to go from walking to attacking or lying down to standing up smoothly. It looks really good when you do it properly.

There are two examples - the first one is the initial tech demo that I used to see if I could get it to work. It is not timer based, and sort of a hack. It's not directly usable in a game in this form, but it's easier to understand.

The second example is timer based. Both the animation and the blending are based on the elapsed time for each loop. This method can, and should, be used in games. It does not rely on the FPS. Also, it is not passive timer control. It will animate the model at the correct speed no matter how fast or slow the computer is running. It will skip frame if necessary, and there is never lag.

First code, non timer-based interpolations.


Second example, using timer based animation and blending.


And finally, the project. The project includes the media necessary to run the project. It's small, a 567 kb .ZIP file. It includes projects of both examples. All you have to do is open them and compile.

Animation Blending, regular and Timer Based project download




All of the code is well commented, so I hope that it's understandable. My hope is that DBP projects will improve with this animation technique. Smoother animations + timer based controls are definitely a plus. It's the same technique that I use in my game, except that I use UDTs to define all of the animation ranges. I didn't include that for the sake of simplicity.

Enjoy!

[EDIT]
Ignore the note about adding syncs to the loop. That was for something I was working with Fallout on.



Come see the WIP!

Attachments

Login to view attachments
Xarshi
18
Years of Service
User Offline
Joined: 25th Dec 2005
Location: Ohio
Posted: 11th Aug 2006 09:23
very nice there,cash. This is very helpful.

Woohoo. DP is finally released!
Alquerian
17
Years of Service
User Offline
Joined: 29th Mar 2006
Location: Reno Nevada
Posted: 16th Aug 2006 01:30
Yeah, very helpful. WAY COOL example! Thanks Cash

"We are what we repeatedly do. Excellence, therefore, is not an act, but a habit." - Aristotle
Cash Curtis II
18
Years of Service
User Offline
Joined: 8th Apr 2005
Location: Corpus Christi Texas
Posted: 16th Aug 2006 02:35
Glad you liked it I tried to make it as simple as possible, but who knows if I did a good job. If you have any questions don't hesitate to ask.


Come see the WIP!
Green7
18
Years of Service
User Offline
Joined: 23rd Nov 2005
Location: Switzerland
Posted: 17th Aug 2006 20:55
so it is not possible yet to combine anims, right?

Alquerian
17
Years of Service
User Offline
Joined: 29th Mar 2006
Location: Reno Nevada
Posted: 17th Aug 2006 20:58
You can with AACode's plugin, but it is expensive and I don't know if he is even alive anymore. People have gotten pretty upset at him around here. But natively in DBPro, the answer is no, not yet anyways. We are yapping about it in another thread:

http://forum.thegamecreators.com/?m=forum_view&t=85943&b=1&p=2 <------- Visit that for more info.

"We are what we repeatedly do. Excellence, therefore, is not an act, but a habit." - Aristotle
Cash Curtis II
18
Years of Service
User Offline
Joined: 8th Apr 2005
Location: Corpus Christi Texas
Posted: 17th Aug 2006 21:00 Edited at: 17th Aug 2006 21:00
Not unless you are manually controlling limbs with DBP.

This functionality is actually provided with Monster's Advanced Animation Plug-in, but he raised the price to around $99, so it's unlikely that anyone will purchase it. Basically, you take the animations of a set of limbs and combine it with a set of animations from a different set of limbs.

Naively, DBP does not support this. This example shows how to effectively blend one animation into another. This gives a good effect in a game, basically all animations are smooth.

[Edit]
Alquerian, you got it right before me


Come see the WIP!
Green7
18
Years of Service
User Offline
Joined: 23rd Nov 2005
Location: Switzerland
Posted: 18th Aug 2006 01:04
hmm, sad news. better vote for better anim controlls, think we could need them.

TEH_CODERER
20
Years of Service
User Offline
Joined: 12th Nov 2003
Location: Right behind you!
Posted: 20th Aug 2006 16:49
This is why I made my own animation system. It can blend and combine and allows for features such as making a character look at something whilst walking past or setting their feet at different heights so that if walking up stairs then it will not look unnatural. It also means that ragdoll physics can be added smoothly by knowing the position and velocity of each limb so that they will fall realistically.

Never thought of doing it like this though. Great work!

[url]andrewneale2004@yahoo.com[/url]
http://www.elbsoftware.dbspot.com

Login to post a reply

Server time is: 2024-03-29 10:23:12
Your offset time is: 2024-03-29 10:23:12