Inverse Kinematics support using OpenTissue
- Noman
- OGRE Retired Team Member
- Posts: 714
- Joined: Mon Jan 31, 2005 7:21 pm
- Location: Israel
- x 2
- Contact:
Inverse Kinematics support using OpenTissue
Hellow fellow Ogre-ers!
I started diving into the world of animation recently, and I decided to try and get Inverse Kinematics working in Ogre.
A thread about inverse kinematics got me looking at OpenTissue, an open source library containing many simulation-oriented algorithms, so I decided to give it a go.
After a bit of work and talking to the developers, I got a first sample working!
This sample just takes a jaiqua and grabs her left arm, making the entire body follow in a (hopefully) convincing fashion.
Note that everything happens in real time, and I do not use any existing animations.
Video of the demo on Vimeo
Vide of the demo on YouTube
As for the sources, you can find the current ones here :
http://nomanogre.googlepages.com/OgreIKDemo.h
http://nomanogre.googlepages.com/OgreIKDemo.cpp
In order to compile the demo, you have to setup OpenTissue and Ogre.
See these links for setting up OpenTissue :
http://www.opentissue.org/wikitissue/in ... OpenTissue
http://www.opentissue.org/wikitissue/in ... OpenTissue
http://www.opentissue.org/wikitissue/in ... t_bindings
(Demo is very simple - press b to move the hand some more)
I currently only use the OpenTissue headers, so you don't need to compile anything.
This is currently just a proof of concept. Its very dirty code (though, it is understandable). I don't understand animation that well yet, so I'm learning as I go along. I will hopefully get to something that is more of a black box solution.
Since OpenTissue can also be used as a physics library, I don't know how that will happen. I don't want to force anyone who wants to use OT for IK to also have to use it for physics, but animation and physics do need to be able to work together.
Dunno where I'm going with this, but I'm going somewhere
(I'd actually really like to hear what people who did physics/animation binding layers have in mind...)
I started diving into the world of animation recently, and I decided to try and get Inverse Kinematics working in Ogre.
A thread about inverse kinematics got me looking at OpenTissue, an open source library containing many simulation-oriented algorithms, so I decided to give it a go.
After a bit of work and talking to the developers, I got a first sample working!
This sample just takes a jaiqua and grabs her left arm, making the entire body follow in a (hopefully) convincing fashion.
Note that everything happens in real time, and I do not use any existing animations.
Video of the demo on Vimeo
Vide of the demo on YouTube
As for the sources, you can find the current ones here :
http://nomanogre.googlepages.com/OgreIKDemo.h
http://nomanogre.googlepages.com/OgreIKDemo.cpp
In order to compile the demo, you have to setup OpenTissue and Ogre.
See these links for setting up OpenTissue :
http://www.opentissue.org/wikitissue/in ... OpenTissue
http://www.opentissue.org/wikitissue/in ... OpenTissue
http://www.opentissue.org/wikitissue/in ... t_bindings
(Demo is very simple - press b to move the hand some more)
I currently only use the OpenTissue headers, so you don't need to compile anything.
This is currently just a proof of concept. Its very dirty code (though, it is understandable). I don't understand animation that well yet, so I'm learning as I go along. I will hopefully get to something that is more of a black box solution.
Since OpenTissue can also be used as a physics library, I don't know how that will happen. I don't want to force anyone who wants to use OT for IK to also have to use it for physics, but animation and physics do need to be able to work together.
Dunno where I'm going with this, but I'm going somewhere
(I'd actually really like to hear what people who did physics/animation binding layers have in mind...)
Last edited by Noman on Sat Feb 07, 2009 7:39 pm, edited 1 time in total.
- jacmoe
- OGRE Retired Moderator
- Posts: 20570
- Joined: Thu Jan 22, 2004 10:13 am
- Location: Denmark
- x 179
- Contact:
Re: Inverse Kinematics support using OpenTissue
This is just so seriously cool and well done, that I am speechless!
Well, almost speechless..
The Jaiqua looks genuinely surprised.
Well, almost speechless..
The Jaiqua looks genuinely surprised.
/* Less noise. More signal. */
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.
- jacmoe
- OGRE Retired Moderator
- Posts: 20570
- Joined: Thu Jan 22, 2004 10:13 am
- Location: Denmark
- x 179
- Contact:
Re: Inverse Kinematics support using OpenTissue
I found this @ the Bullet forum:
http://www.bulletphysics.com/Bullet/php ... f=6&t=2952
I don't know how useful it is - and what license it's under - but it could be useful. If you're planning on using something a lot leaner than OpenTissue.
<edit>
Can I move this to Showcase?
</edit>
http://www.bulletphysics.com/Bullet/php ... f=6&t=2952
I don't know how useful it is - and what license it's under - but it could be useful. If you're planning on using something a lot leaner than OpenTissue.
<edit>
Can I move this to Showcase?
</edit>
/* Less noise. More signal. */
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.
- Noman
- OGRE Retired Team Member
- Posts: 714
- Joined: Mon Jan 31, 2005 7:21 pm
- Location: Israel
- x 2
- Contact:
Re: Inverse Kinematics support using OpenTissue
I thought about making this thread in showcase, but I think its too preliminary... Maybe when a cooler demo is done...
And yea, I saw that post (in the gamedev forums). I didn't see what he did yet, but he is just one person who implemented some algos. OpenTissue isn't a huge organization, but they do have a few people on the team with some serious theory behind them. I'm not sure if his results are any better. Did you manage to find some samples of his work in action?
And yea, I saw that post (in the gamedev forums). I didn't see what he did yet, but he is just one person who implemented some algos. OpenTissue isn't a huge organization, but they do have a few people on the team with some serious theory behind them. I'm not sure if his results are any better. Did you manage to find some samples of his work in action?
- Noman
- OGRE Retired Team Member
- Posts: 714
- Joined: Mon Jan 31, 2005 7:21 pm
- Location: Israel
- x 2
- Contact:
Re: Inverse Kinematics support using OpenTissue
Another small update (Exam period... Not much time for hobbies)
Two things were done :
A) Initial orientation support
B) Moved the OpenTissue code into a separate project, so that it theoretically will work in library form.
I modified the demo to also include support for (dynamic real time) Inverse Kinematics use case #2 : Looking at points.
Here our favorite robot, moving his body in order for his head to turn to the direction of the camera.
As always, the animation is generated at runtime :
And a video of the demo on Vimeo and the same video on YouTube.
This is still very primary, and many things don't work yet. But progress is (slowly) being made.
Sources can be found at http://nomanogre.googlepages.com/OgreTissue.zip . For those who want to build it, see first post.
I'll open the repository to the public when this project really takes off...
Two things were done :
A) Initial orientation support
B) Moved the OpenTissue code into a separate project, so that it theoretically will work in library form.
I modified the demo to also include support for (dynamic real time) Inverse Kinematics use case #2 : Looking at points.
Here our favorite robot, moving his body in order for his head to turn to the direction of the camera.
As always, the animation is generated at runtime :
And a video of the demo on Vimeo and the same video on YouTube.
This is still very primary, and many things don't work yet. But progress is (slowly) being made.
Sources can be found at http://nomanogre.googlepages.com/OgreTissue.zip . For those who want to build it, see first post.
I'll open the repository to the public when this project really takes off...
-
- Halfling
- Posts: 60
- Joined: Fri Jun 17, 2005 10:47 am
Re: Inverse Kinematics support using OpenTissue
Thanks Noman for the great job. I am watching all the threads related to IK in Ogre as this is a feature I really miss.
Looking forward to be able to make my AI bots with completely runtime-calculated IK animations
Looking forward to be able to make my AI bots with completely runtime-calculated IK animations
- iloseall
- Gremlin
- Posts: 156
- Joined: Sun Sep 14, 2003 3:54 am
- Location: Beijing China
- Contact:
Re: Inverse Kinematics support using OpenTissue
Perfect!! I am !
What's about performance?
What's about performance?
-
- Gnoblar
- Posts: 2
- Joined: Sun Jan 25, 2009 12:02 pm
Re: Inverse Kinematics support using OpenTissue
I am trying out this IK solution for a project of mine but I am finding the performance of the OpenTissue IK performance really bad, the frame rate dips very significantly when IK is active. I am using a more detailed mesh than in these demos, but the skeletal structure shouldn't be alot more complex. Is this normal? Can you suggest any workarounds?
- Noman
- OGRE Retired Team Member
- Posts: 714
- Joined: Mon Jan 31, 2005 7:21 pm
- Location: Israel
- x 2
- Contact:
Re: Inverse Kinematics support using OpenTissue
I did not get to use the integration layer in real-world applications yet...
IK is not an easy task. There are ways to configure the is parameters for the IK solver to cause faster calculation times.
However, compatibility is a bigger concern than speed for me, currently.
Once the library is working correctly, performance can be improved.
Things that I can easily think of are -
1) Threading - its a pretty easily threaded problem.
2) Less calculations - you can calculate the IK state once every X frames and interpolate between the two until the next calculation is done. You could have the worker thread work as fast as possible, updating the results whenever it finishes a round, but keep on rendering (and skip an IK frame).
You are more than welcome to expand it, this is a very early state (and isn't working correctly in all cases yet).
Also, the guys at OpenTissue will probably know more than me, and they are quite happy to help...
IK is not an easy task. There are ways to configure the is parameters for the IK solver to cause faster calculation times.
However, compatibility is a bigger concern than speed for me, currently.
Once the library is working correctly, performance can be improved.
Things that I can easily think of are -
1) Threading - its a pretty easily threaded problem.
2) Less calculations - you can calculate the IK state once every X frames and interpolate between the two until the next calculation is done. You could have the worker thread work as fast as possible, updating the results whenever it finishes a round, but keep on rendering (and skip an IK frame).
You are more than welcome to expand it, this is a very early state (and isn't working correctly in all cases yet).
Also, the guys at OpenTissue will probably know more than me, and they are quite happy to help...
- Noman
- OGRE Retired Team Member
- Posts: 714
- Joined: Mon Jan 31, 2005 7:21 pm
- Location: Israel
- x 2
- Contact:
Re: Inverse Kinematics support using OpenTissue
Calculating IK every X frames is just a matter of keeping a counter and not calling the solve() method every frame.
As for performance considerations, I really understand less about IK than they do. I'd recommend asking at the OpenTissue Usage forum, they are happy to help.
As for performance considerations, I really understand less about IK than they do. I'd recommend asking at the OpenTissue Usage forum, they are happy to help.
-
- Gnoblar
- Posts: 1
- Joined: Mon Jun 01, 2009 9:25 pm
Re: Inverse Kinematics support using OpenTissue
In this web:
http://sites.google.com/site/proyectosroboticos/
You will solve the inverse kinematics from 2 up to 5 degrees of freedom.
Regards.
http://sites.google.com/site/proyectosroboticos/
You will solve the inverse kinematics from 2 up to 5 degrees of freedom.
Regards.
- oddrose
- Orc
- Posts: 470
- Joined: Thu Feb 15, 2007 2:08 pm
- Location: Gothenburg, Sweden
- Contact:
Re: Inverse Kinematics support using OpenTissue
hey, do you know if the code is up to date with OpenTissue?
I get an error when I try to compile:
I can't find it in the OpenTissue source...
I get an error when I try to compile:
Code: Select all
'set_default_joint_settings' : is not a member of 'OpenTissue::kinematics::inverse'
- krushak
- Gnoblar
- Posts: 4
- Joined: Wed Jun 06, 2007 9:55 pm
Re: Inverse Kinematics support using OpenTissue
it's not up to date. So change the line into
and it works fine for latest OpenTissue Version.
Code: Select all
OpenTissue::kinematics::inverse::set_joint_parameters( mOTSkeleton );
-
- Gnoblar
- Posts: 3
- Joined: Sat Dec 05, 2009 2:00 pm
Re: Inverse Kinematics support using OpenTissue
Hi.
I have a Problem compiling your first project. I installed OpenTissue but i get the following error messages when compiling:
/usr/local/OpenTissue/kinematics/skeleton/io/skeleton_xml_write.h: In function ‘bool OpenTissue::skeleton::detail::xml_write(TiXmlDocument&, const skeleton_type&)’:
/usr/local/OpenTissue/kinematics/skeleton/io/skeleton_xml_write.h:58: error: no matching function for call to ‘TiXmlElement::SetAttribute(const char [9], std::basic_string<char, std::char_traits<char>, std::allocator<char> >&)’
/usr/local/third_party/include/TinyXML/tinyxml.h:872: note: candidates are: void TiXmlElement::SetAttribute(const char*, const char*)
/usr/local/third_party/include/TinyXML/tinyxml.h:901: note: void TiXmlElement::SetAttribute(const char*, int)
I get this message a lot of times and havent found an answer by google. Has someone an idea ?
I have a Problem compiling your first project. I installed OpenTissue but i get the following error messages when compiling:
/usr/local/OpenTissue/kinematics/skeleton/io/skeleton_xml_write.h: In function ‘bool OpenTissue::skeleton::detail::xml_write(TiXmlDocument&, const skeleton_type&)’:
/usr/local/OpenTissue/kinematics/skeleton/io/skeleton_xml_write.h:58: error: no matching function for call to ‘TiXmlElement::SetAttribute(const char [9], std::basic_string<char, std::char_traits<char>, std::allocator<char> >&)’
/usr/local/third_party/include/TinyXML/tinyxml.h:872: note: candidates are: void TiXmlElement::SetAttribute(const char*, const char*)
/usr/local/third_party/include/TinyXML/tinyxml.h:901: note: void TiXmlElement::SetAttribute(const char*, int)
I get this message a lot of times and havent found an answer by google. Has someone an idea ?
-
- Halfling
- Posts: 68
- Joined: Mon Nov 09, 2009 10:30 pm
- Location: Barcelona, Spain
- x 1
Re: Inverse Kinematics support using OpenTissue
To me, it seems your TinyXML version isn't the same OpenTissue used when developing. You should check the versions.
-
- Gnoblar
- Posts: 3
- Joined: Sat Dec 05, 2009 2:00 pm
Re: Inverse Kinematics support using OpenTissue
i solved the problem. The TinyXML was the one from OpenTissue so the version was right. But when compiled under linux one must add the following before include something from opentissue
Then everything works.
Code: Select all
#ifndef USE_TICPP_H
#define USE_TICPP_H
#endif
// Wrapper to neaten up #defs below.
#ifndef TIXML_USE_TICPP
#define TIXML_USE_TICPP
#endif
#ifndef TIXML_USE_STL
#define TIXML_USE_STL
#endif
-
- Gnoblar
- Posts: 3
- Joined: Sat Dec 05, 2009 2:00 pm
Re: Inverse Kinematics support using OpenTissue
Has anyone tested it with some other examples. i tried the same code that works with jaiqua with an other model i work with and get a segmantation fault when pressing b. I changed the codeline
so that it works with the model i use. The method takeoverskeleton works and detects every bone and the right bone is also saved in mLefthandChain, but when i press 'b' i get an segmentation fault. Has anyone an idea ?
Code: Select all
if (bone->get_name() == "Lfingers")
-
- Gnoblar
- Posts: 1
- Joined: Thu Jun 10, 2010 8:16 pm
Re: Inverse Kinematics support using OpenTissue
I've managed to get your code up and running with my own model.
I'm trying to make the inverse kinematics work a little more fluidly, limiting the movement to just the right arm.
I've run into 2 issues:
Animation gets all kinds of messed up, I only get positive results without any animation, I think the Inverse kinematics solve doesn't take into account the offset that Ogre's animation controller applies to the bone.
ALSO,
It's super slow, I think if I move the root up to the bone in the neck where the arm connects to the body, I can save some cycles, I'm just not sure how to move it! I hope that you fine folks have put some time into this and can give me hand.
Thanks!
I'm trying to make the inverse kinematics work a little more fluidly, limiting the movement to just the right arm.
I've run into 2 issues:
Animation gets all kinds of messed up, I only get positive results without any animation, I think the Inverse kinematics solve doesn't take into account the offset that Ogre's animation controller applies to the bone.
ALSO,
It's super slow, I think if I move the root up to the bone in the neck where the arm connects to the body, I can save some cycles, I'm just not sure how to move it! I hope that you fine folks have put some time into this and can give me hand.
Thanks!
-
- Gnoblar
- Posts: 5
- Joined: Sun Jul 10, 2011 1:12 pm
Re: Inverse Kinematics support using OpenTissue
What this code does?
And where can I find documentation on OpenTissue? I've tried to understand something just by comments, but that's imposible. It's interesting, how author came up to this without documentation...
Code: Select all
void SkeletalChain::setTargetOrientation(const Ogre::Quaternion& orientation)
{
mChain.only_position() = false;
//TODO : Is this correct?
mOrientation = orientation;
Ogre::Vector3 xAxis = orientation.xAxis();
mChain.x_global()[0] = xAxis.x;
mChain.x_global()[1] = xAxis.y;
mChain.x_global()[2] = xAxis.z;
Ogre::Vector3 yAxis = orientation.yAxis();
mChain.y_global()[0] = yAxis.x;
mChain.y_global()[1] = yAxis.y;
mChain.y_global()[2] = yAxis.z;
}
- jacmoe
- OGRE Retired Moderator
- Posts: 20570
- Joined: Thu Jan 22, 2004 10:13 am
- Location: Denmark
- x 179
- Contact:
Re: Inverse Kinematics support using OpenTissue
Is that really so hard?
http://lmgtfy.com/?q=opentissue
http://lmgtfy.com/?q=opentissue
/* Less noise. More signal. */
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.
-
- Gnoblar
- Posts: 5
- Joined: Sun Jul 10, 2011 1:12 pm
Re: Inverse Kinematics support using OpenTissue
And what should I click on? I was on opentissue.org and maybe I'm too blind, but I see nothing. Kinematics->Character Animation ... what else... that's all!
Also, there was the first question about the code. It is far more important for me now (than documentation).
Also, there was the first question about the code. It is far more important for me now (than documentation).
- jacmoe
- OGRE Retired Moderator
- Posts: 20570
- Joined: Thu Jan 22, 2004 10:13 am
- Location: Denmark
- x 179
- Contact:
Re: Inverse Kinematics support using OpenTissue
In a nutshell.Pixar wrote:Kinematics->Character Animation ... what else... that's all!
They have got a fairly complete wiki, haven't they?
And books too.
And the code: it sets the target orientation on a skeletal chain.
That is OpenTissue specific.
/* Less noise. More signal. */
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.
-
- Gnoblar
- Posts: 3
- Joined: Fri Feb 19, 2010 3:24 pm
- Location: Hungary
Re: Inverse Kinematics support using OpenTissue
Does anybody find documentation for OpenTissue about inverse kinematics?
I would like to read the OpenTissue Usage forum (what Noman recommended), but the link appears broken.
I would like to read the OpenTissue Usage forum (what Noman recommended), but the link appears broken.
-
- Gnoblar
- Posts: 1
- Joined: Sat Feb 11, 2012 6:00 am
Re: Inverse Kinematics support using OpenTissue
Hi there,
Firstly thank you so much for providing this demo. I'm relatively new to OGRE and i've been wondering how to do this sort of thing for ages!
I'm trying to run the demo code, but i keep getting a Debug Assertion "invalid null pointer" error.
I've done some debugging and determined that it gets thrown on this line:
mSolver = OpenTissue::kinematics::inverse::make_solver( mOTSkeleton );
However i've checked and its definitely referencing the mesh and skeleton correctly, and finding joints fine so i'm not really sure what could possibly be null.
This exact error gets thrown on both of the sample demos in the same place
Does anyone have any ideas?
Thank you!
Sparrow
Firstly thank you so much for providing this demo. I'm relatively new to OGRE and i've been wondering how to do this sort of thing for ages!
I'm trying to run the demo code, but i keep getting a Debug Assertion "invalid null pointer" error.
I've done some debugging and determined that it gets thrown on this line:
mSolver = OpenTissue::kinematics::inverse::make_solver( mOTSkeleton );
However i've checked and its definitely referencing the mesh and skeleton correctly, and finding joints fine so i'm not really sure what could possibly be null.
This exact error gets thrown on both of the sample demos in the same place
Does anyone have any ideas?
Thank you!
Sparrow
-
- Gnoblar
- Posts: 1
- Joined: Wed Sep 11, 2013 7:28 pm
Re: Inverse Kinematics support using OpenTissue
I used MS VS 2010 and met exactly the same problem.
For Release version, the code runs smoothly. For Debug version, I tried pressing "Ignore" for the Debug Assertion for 14 times and the program finally got running.
For Release version, the code runs smoothly. For Debug version, I tried pressing "Ignore" for the Debug Assertion for 14 times and the program finally got running.
sparrow wrote:Hi there,
Firstly thank you so much for providing this demo. I'm relatively new to OGRE and i've been wondering how to do this sort of thing for ages!
I'm trying to run the demo code, but i keep getting a Debug Assertion "invalid null pointer" error.
I've done some debugging and determined that it gets thrown on this line:
mSolver = OpenTissue::kinematics::inverse::make_solver( mOTSkeleton );
However i've checked and its definitely referencing the mesh and skeleton correctly, and finding joints fine so i'm not really sure what could possibly be null.
This exact error gets thrown on both of the sample demos in the same place
Does anyone have any ideas?
Thank you!
Sparrow