Using a rigged ManuelbastioniLAB character in Panda 3D

I am trying to use the ManuelbastioniLAB Blender add-on at http://www.manuelbastioni.com/manuellab.php (which is a MakeHuman replacement) with Panda 3D.

I have successfully created a character with Blender 2.79 and loaded it as an Actor in Panda 3D. However, when I move the leg using a Python script, the leg moves to the new position as expected but also distorts horribly.

Has anyone used the ManuelbastioniLAB characters with Panda 3D and if so, what do I need to control in order to move the body parts without the distortion I am seeing ?

Does ManuelbastioniLAB expect the characters to be used with the Blender Game Engine or should I be able to move the leg (for example) within Panda 3D without seeing visual distortion ?

While I am an experienced programmer, I am very new to the game engine and Blender world, so there may be some basic concepts I am missing. If that is the case, feel free to point me in the correct direction and I will be happy to read whatever tutorial or reference material you point me to.

For example, I don’t know at the moment how, in Panda 3D, I can stop the leg from rotating forward past what a real human leg should not be able to do or whether this is something I have to handle manually.

Thank you for any help you can give.

What you are asking about is called Inverse Kinematics. Panda3D does not currently support it out-of-the-box but it is possible to implement one on top of Panda3D.

Thank you rdb.

From various keyword searches and from reading various posts, it doesn’t look like there’s an already existing IK module which can be directly used with Panda3D.

I have come across suggestions that ODE might be suitable but with the warning that the ODE implementation isn’t a “real” IK implementation. I also can’t see a way that Bullet would be suitable here unless I have missed something.

What would be the recommended starting point for implementing IK (or something lower-level that can be made to achieve the same thing as IK) on top of Panda3D ? Is ODE my best bet ?

As a more general question, when people here need to implement rigged human characters in Panda3D, what tool(s) do you use to create them and what libraries do you use to control them ?

Thanks once again for any answers or general advice.

I would first consider whether you actually need real-time IK, or whether you can load your rig into an animation program such as Blender and design your animations ahead of time. Blender supports setting up constraints and IK for posing your model, which can aid you in making animations and poses which could then be exported to Panda3D. This will be sufficient if it is the case that all your animations (eg. walk, run, climb) are known ahead of time, such as in many games, but it will fall short if your models need to dynamically interact with the scene in complex ways (eg. a hand needs to reach out to touch an object at arbitrary location, or a foot needs to be precisely placed on an arbitrary obstacle). In those cases you may need IK.

Given that neither ODE nor Bullet actually support IK, I would not use either of them as a starting point for implementing IK unless I were already using those physics engines in my application.

There seems to have been an attempt to implement a FABRIK solver in Panda3D, but you would need to request them for the code.

It may also be that there are Python packages (such as this one) that can help you implement IK. You would mainly be writing the code that gets the joint information from Panda3D into the library, and get the transformed joints from the library back onto the Panda3D generated model.

Failing all that, I would suggest you look at an IK algorithm paper (such as FABRIK) and implement it on top of Panda3D directly. Let us know if you run into anything that you need help with; there are others on the forums here who are also interested in IK.

Yes it does need to be dynamic because I do need the character to interact with the environment so static generated animations are not sufficient.

I’ve looked at the post you have referenced and it seems the solver was a work in progress. It also seems a lot of heavy mathematics is required to finish it even if the source code is still available.

I’ve done some more research and I am now wondering if a FK approach instead of an IK approach will be sufficient although it looks like more code will be required in that case. I’ve also found an IK to FK plugin for Blender so I will see if that gets me any further forward when exporting the character from Blender.

Thanks for your answers and I will ask if I have any more questions.

BTW, it looks like you are one of the Panda3D developers, so I will say that the Panda3D manual was very useful in explaining a number of general concepts. Like I said, I’m an experienced programmer but this art/graphics/animation/etc world is very new to me and at times the conceptual information was very useful in filling in some missing knowledge.

Forward Kinematics is the opposite problem of Inverse Kinematics, and is what Panda3D effectively does support. It does not help you solve the problem of determining where all the bones should be in order for a particular bone to be at a particular location and orientation.

Glad to hear the manual was helpful.

Yes, I know that FK is the opposite of IK but remember what my original problem was. I was moving a leg under program control to a position I chose and the leg was distorting horribly. It was the distortion I was trying to fix.

Since I was effectively doing FK anyway, that’s why I tried the IK to FK rig conversion script (which BTW doesn’t work with a MBL character - the script crashes during execution) in the hope I could control the converted bones without seeing distortion.

I have found what may be another solution however. Investigating the MBL add-on source code reveals that different rigs are used depending on the options chosen during character creation.

When creating the character in Blender, if you turn off the IK option (which I had already tried without success) AND if you turn off the basic muscles option then you get a much less complex rig.

I have been able to move the leg on this less complex character from within Panda 3D without seeing any visual distortion. I don’t know yet what additional functionality I may have lost, so I don’t know if this is suitable when I get further down the road, but it has solved the immediate distortion issue I was experiencing.

I have looked again at creating my own IK library and that’s not an option I think is going to be viable for me given the amount of work that appears to be involved and given I can probably achieve what I want with FK at the expense of more coding by myself.