Animation system

Post those lines of code you feel like sharing or find what you require for your project here; or simply use them as tutorials.
Post Reply
3DModelerMan
Posts: 1691
Joined: Sun May 18, 2008 9:42 pm

Animation system

Post by 3DModelerMan »

Here is early code for an animation system. Features so far include:
  • Named animations
    Seperate mesh and animation data
    Animation chaining
    Transition management

Planned features include:
  • Animation masks
    Lip sync
    Layered blending
    Frame callbacks
    Replacing animations that are already stored
Download: http://www.mediafire.com/?arqlpxh1w01hki9

The commented out stuff was from a previous version, so just ignore it.
Feel free to ask any questions and suggest improvements. The code has been tested on Windows 7 64bit, using .B3D meshes and animations.
Have fun.

Example usage

Code: Select all

//Creating animation system
animCtrl = new CAnimationController(smgr->getMesh("model_file.b3d"), smgr);

//Creating an animation
SAnimation anim;
anim.m_name = "anim name";
anim.m_anim = (irr::scene::ISkinnedMesh*)smgr->getMes("anim.b3d");
animCtrl->addAnimation(anim);

//Playing an animation
animCtrl->playAnimation("anim_name");
That would be illogical captain...

My first full game:
http://www.kongregate.com/games/3DModel ... tor#tipjar
EvIl_DeViL
Posts: 89
Joined: Tue Nov 06, 2007 4:49 pm

Post by EvIl_DeViL »

nice! look interesting; especially the lip sync feature! at what stage is the development? how are you planning to implement it?
I made something similar in the past (named anim, locking actions while others are running and so on...) but I stopped developing that part :p
waiting for more! good work! ;)
3DModelerMan
Posts: 1691
Joined: Sun May 18, 2008 9:42 pm

Post by 3DModelerMan »

I'm actually going to be implementing a better one at some point. That one is a temporary system that I have in place until I can figure out blend trees and IK for bone chains longer than two bones. I'll probably post it when it's ready, but don't count on it for a while.
That would be illogical captain...

My first full game:
http://www.kongregate.com/games/3DModel ... tor#tipjar
eye776
Posts: 94
Joined: Sun Dec 28, 2008 11:07 pm

Post by eye776 »

Interesting, I'm working on an animation system too, got the blend trees pretty much down (but they're only composed of binary "modifiers" for now), and there's no IK in mine yet either (but it's postponed it for now).

I'm stuck in the conversion tool phase however, since:
1) I don't want to code loaders for the metric ton of different animation file formats out there.
2) Making complex blend trees in code can get very complicated.
3DModelerMan
Posts: 1691
Joined: Sun May 18, 2008 9:42 pm

Post by 3DModelerMan »

The way I was gonna do it was by writing a converter for all the formats using the open asset import library, and having my own animation formats. I was also going to write a blend tree editor. Maybe if I could find and open source alternative to visio with plugin support or something...
That would be illogical captain...

My first full game:
http://www.kongregate.com/games/3DModel ... tor#tipjar
EvIl_DeViL
Posts: 89
Joined: Tue Nov 06, 2007 4:49 pm

Post by EvIl_DeViL »

you may probably find this useful: http://www.lostmarble.com/papagayo/index.shtml
is in 2d but is open source, gpl... taking inspiration from a couple of algorithms could cut out a lot of work; morphing lips when you have already sync sounds with calls to the morph function is a shorter step :)

about animating: a long time ago a user made that... http://irrlicht.sourceforge.net/phpBB2/ ... hp?t=23344

hope to be helpful :p[/url]
mongoose7
Posts: 1227
Joined: Wed Apr 06, 2011 12:13 pm

Post by mongoose7 »

That's an interesting idea - to code walk cycles using trigonometric functions. I've been looking at some uncleaned BVH files an I thought that what is really required is nice clean motions. But you can't use sine/cosine for a walk cycle because you need a discontinuous derivative when a foot hits the ground. It seems that the best idea is to use something like harmonic functions but then apply some IK feedback where it is required. Should affect knees and hips but maybe OK to just adjust the knees.
eye776
Posts: 94
Joined: Sun Dec 28, 2008 11:07 pm

Post by eye776 »

Well, in my animation system the plan is for an interface (IProceduralMotion for eg ?) that has special access to the timeline and bones and can be extended to contain ... whatever kind of function is needed.
Post Reply