skeletal human animations [UPDATED]
skeletal human animations [UPDATED]
UPDATED 7. december 2008
I made some big updates to my animation class. First
one is that there are four new animations and the existing where
updated. Now the class can simulate this:
+ running (improved)
+ walking
+ jump (improved)
+ strafe left (new)
+ strafe right (new)
+ backward (new)
+ head will point to mouse direction, to simulate watching (new)
I also recoded the whole interpolation structure for blending from one
to another animation. Now you dont have to code it by your own for example if you want to add your own animation. This blending function
is able to handle every function you create. So if you want to add your own
animation, do the following ->
- create an extra function in the skeleton class (private section)
which handles your animation
- extend the switch branch in 'animSkeleton' and 'animInterpolation'
- thats it
So give it a try i know you will like it, the demo shows also a moving player and fade moving camera system!! Link as usual or on my website:
http://www.solar-ray.org
---------------------------------------------
A new version is out, and now it looks much more realistic.
I added to all animations shaking bones, also the blendings
are now a little bit better, so have a look at it!
---------------------------------------------
Now it works also with Irrlicht 1.4, so you dont need Acki's IrrExtension !
---------------------------------------------
I changed some things to the class:
+ improved running mode
+ added walk cycle
+ added motion in stand position
original post:
---------------------------------------------
I wrote a class which calculates skeleton human animations in realtime, so this is not a frame based animation. For my project Im needing running/walking/jumping... animations for the main player. But I dont want to use frame based animations like the md2 format, because later I want an easy way to implement other players, this way that I just have to model them with their bones in blender and import them into my project. So this would be also really easy for other fans of my project to implement their own players, without recreating all the animations. The other Idea is that realtime calculated animations could have smooth blending effects from one anim to another one.
Here you can download the packed source:
http://home.mnet-online.de/sk9/skeleton.rar
Needed files for the skeleton animations in your project:
+Skeleton.h
+Skeleton.cpp
+BMaths.h
+BMaths.cpp
I hope my source is documented well enough for you
There is also a compiled version if you just want to have a look at it!
I also copied the blender file with the human into it, the human isnt good
enough for my project but will maybe helpful for someone.
Comments are welcome
I made some big updates to my animation class. First
one is that there are four new animations and the existing where
updated. Now the class can simulate this:
+ running (improved)
+ walking
+ jump (improved)
+ strafe left (new)
+ strafe right (new)
+ backward (new)
+ head will point to mouse direction, to simulate watching (new)
I also recoded the whole interpolation structure for blending from one
to another animation. Now you dont have to code it by your own for example if you want to add your own animation. This blending function
is able to handle every function you create. So if you want to add your own
animation, do the following ->
- create an extra function in the skeleton class (private section)
which handles your animation
- extend the switch branch in 'animSkeleton' and 'animInterpolation'
- thats it
So give it a try i know you will like it, the demo shows also a moving player and fade moving camera system!! Link as usual or on my website:
http://www.solar-ray.org
---------------------------------------------
A new version is out, and now it looks much more realistic.
I added to all animations shaking bones, also the blendings
are now a little bit better, so have a look at it!
---------------------------------------------
Now it works also with Irrlicht 1.4, so you dont need Acki's IrrExtension !
---------------------------------------------
I changed some things to the class:
+ improved running mode
+ added walk cycle
+ added motion in stand position
original post:
---------------------------------------------
I wrote a class which calculates skeleton human animations in realtime, so this is not a frame based animation. For my project Im needing running/walking/jumping... animations for the main player. But I dont want to use frame based animations like the md2 format, because later I want an easy way to implement other players, this way that I just have to model them with their bones in blender and import them into my project. So this would be also really easy for other fans of my project to implement their own players, without recreating all the animations. The other Idea is that realtime calculated animations could have smooth blending effects from one anim to another one.
Here you can download the packed source:
http://home.mnet-online.de/sk9/skeleton.rar
Needed files for the skeleton animations in your project:
+Skeleton.h
+Skeleton.cpp
+BMaths.h
+BMaths.cpp
I hope my source is documented well enough for you
There is also a compiled version if you just want to have a look at it!
I also copied the blender file with the human into it, the human isnt good
enough for my project but will maybe helpful for someone.
Comments are welcome
Last edited by xray on Sun Dec 07, 2008 6:36 pm, edited 5 times in total.
-
- Posts: 109
- Joined: Tue Jan 09, 2007 1:18 pm
What is it for, does it use actual models for rendering?
Crimson Glory full Irrlicht game source code!
What I Do - my blog & dev log
Currently developing Link-Dead
What I Do - my blog & dev log
Currently developing Link-Dead
I thought it would be clear, well I need a player model for my projectWhat is it for
as alot of other developers, and this models have to be animated! Otherwise
it will not look realistic. So my class animates a human, and you dont have
to create frame based animations in a 3d app. You only have to create a player model for example in blender and append it to the class.
dont understand what you mean.does it use actual models for rendering?
cool thanks! Can you tell us what bone layout we need for this to be compatible? I have a very simple layout for hands and legs, 2 for each leg and 2 for each arm. Would this work with your code and if it wont what modifications would be needed?
ShadowMapping for Irrlicht!: Get it here
Need help? Come on the IRC!: #irrlicht on irc://irc.freenode.net
Need help? Come on the IRC!: #irrlicht on irc://irc.freenode.net
One thing before, I forgot to say that you only need the CustomBones from Ackis IrrExtension, not the hole branch of his extensions.
Now to your question BlindSide:
It is really simply to modify it to your terms. My player skeleton has the following bones:
- torso
- body
- neck
- head
- arms
- under arms
- hands
- fingers
- legs
- shins
- feets
- toes
Note, that yet not all of this bones are animated with my class like toes, feets, fingers and hands. So lets take your bone example:
- legs
- shins
- arms
- under arms
- hands (not needed, cause there isnt an animation yet)
It would be good if you apply to your skeleton a torso or a body bone which is a parent of all others so that you can modify the hole position/rotation of the player over this main bone. If you have a look into the Skeleton header you will find an enumeration in private section named "SKT_BONE"! Simple remove the bones which you dont have... for you it should look like this:
The "SKT_BONE_ZERO" is just because of the first enum = "0" isnt a bone, I dont know why. Maybe it is differrent with your one so you may uncomment it.
Another important thing is the order of SKT_BONES, they arent random. They have to be the order you created the bones in your 3d app.
After you changed the enumeration to your needs, you have to uncomment some bone oscillation functions in the skeketon.cpp! In there you will find the method "animSkeleton" where the bone positions are calculated, it should work if you just uncomment all the bonesOsci assignations of the bones which you dont have. For example you dont have body/neck/torso bones so just uncomment all the:
The model will be loaded over the constructor. If you want you can change some things in there like the file name of the model or the stand position.
greetings!
Now to your question BlindSide:
It is really simply to modify it to your terms. My player skeleton has the following bones:
- torso
- body
- neck
- head
- arms
- under arms
- hands
- fingers
- legs
- shins
- feets
- toes
Note, that yet not all of this bones are animated with my class like toes, feets, fingers and hands. So lets take your bone example:
- legs
- shins
- arms
- under arms
- hands (not needed, cause there isnt an animation yet)
It would be good if you apply to your skeleton a torso or a body bone which is a parent of all others so that you can modify the hole position/rotation of the player over this main bone. If you have a look into the Skeleton header you will find an enumeration in private section named "SKT_BONE"! Simple remove the bones which you dont have... for you it should look like this:
Code: Select all
enum SKT_BONE {
SKT_BONE_ZERO,
// main items
SKT_BONE_TORSO,
// right arm items
SKT_BONE_ARM_R,
SKT_BONE_UARM_R,
SKT_BONE_HAND_R,
// left arm items
SKT_BONE_ARM_L,
SKT_BONE_UARM_L,
SKT_BONE_HAND_L,
// right leg items
SKT_BONE_LEG_R,
SKT_BONE_SHIN_R,
// left leg items
SKT_BONE_LEG_L,
SKT_BONE_SHIN_L,
// number of bones
SKT_BONE_COUNT
};
Another important thing is the order of SKT_BONES, they arent random. They have to be the order you created the bones in your 3d app.
After you changed the enumeration to your needs, you have to uncomment some bone oscillation functions in the skeketon.cpp! In there you will find the method "animSkeleton" where the bone positions are calculated, it should work if you just uncomment all the bonesOsci assignations of the bones which you dont have. For example you dont have body/neck/torso bones so just uncomment all the:
Code: Select all
// bonesOsci[SKT_BONE_NECK]...
// bonesOsci[SKT_BONE_BODY]...
// bonesOsci[SKT_BONE_TORSO]...
greetings!
Hi xray!
Your animation system looks just like what I have been searching for.
I do not program in C++, anyway I would like to ask you a general question:
In your animation system you state e. g. that when Bone1 is at location X1 then Bone2 must be at location x2, correct?
In this step, you do nothing else but calculate bone positions, and you name this part the "constructor", right?
Second question:
If you want to make e. g. the head bigger ingame or the nose smaller... how would you achieve this? This doesn't seem to have anything to do with the bones, right?
Thank you very much for a reply.
Your animation system looks just like what I have been searching for.
I do not program in C++, anyway I would like to ask you a general question:
In your animation system you state e. g. that when Bone1 is at location X1 then Bone2 must be at location x2, correct?
In this step, you do nothing else but calculate bone positions, and you name this part the "constructor", right?
Second question:
If you want to make e. g. the head bigger ingame or the nose smaller... how would you achieve this? This doesn't seem to have anything to do with the bones, right?
Thank you very much for a reply.
In what language do you code ?I do not program in C++, anyway I would like to ask you a general question:
The first thing is right, that I do nothing else than calculating the bones rotations. But no this is not the "constructor". If you dont know c++ I could imagine that you also dont know classes. The constructor is nothing specifig of my skeleton class. In classes you have every time an constructor and a destructor. The constructor is called when you "create" a variable of the type of the class, like this:In your animation system you state e. g. that when Bone1 is at location X1 then Bone2 must be at location x2, correct?
In this step, you do nothing else but calculate bone positions, and you name this part the "constructor", right?
Code: Select all
cSkeleton *skeleton;
Well at the moment the animations are only achieved by rotating the bones, I also tested scaling them but without any effect. But I think that must also work. Maybe it lies on ackis irr extension, I dont know, I have to ask him...If you want to make e. g. the head bigger ingame or the nose smaller... how would you achieve this? This doesn't seem to have anything to do with the bones, right?
Do you want to translate the code into another language?
xray have you tried the skinnedMesh branch? It supports setting the scale and position of bones.
ShadowMapping for Irrlicht!: Get it here
Need help? Come on the IRC!: #irrlicht on irc://irc.freenode.net
Need help? Come on the IRC!: #irrlicht on irc://irc.freenode.net
skinnedMesh is the new system you are talking about, you can find it in the irrlicht SVN on sourceforge. It is working very well right now with MS3D and B3D models, and X support is almost complete.
ShadowMapping for Irrlicht!: Get it here
Need help? Come on the IRC!: #irrlicht on irc://irc.freenode.net
Need help? Come on the IRC!: #irrlicht on irc://irc.freenode.net