Blender Animation -> Panda3D

Hi all,

I have been trying to export an animated character from Blender to Panda3d for a full week now…
I tried about all conversions I could think off (Yabee -> egg, Collada, .x format, …).

I’m using blender 2.62.

I’ve tried several character models found online ( If the characters didn’t have an armature already, I added one.

Exporting with Yabee to .egg or exporting to Collada almost always fails, resulting in errors in the export scripts. Exporting to .x doesn’t keep the armature animation, it only seems to export (or import in panda3d) global translations of the model.

So… I was wondering; how do most people export their animations? I’m rather new to both Blender and Panda3d so I suppose I’m doing something wrong as I can’t believe professional game developers don’t have a robust pipeline to import their animations into a gaming engine?

Kind regards,

Here are my own rules for animations and exporting to panda:

  • If you have a rigged model, make sure the bones are bound to vertex groups or through weight painting.
  • Disable envelopes.
  • Animate through keyframes only.
  • Use one armature per object and one object per armature. (an object can contain multiple meshes.)
  • Connect the object with the armature through an armature modifier (and only that!).
  • Define actions if you have multiple independent animations. If the object is simple and animates linearly, you can use YABEE’s animation baking. Just define the right frames for that when exporting.
  • Make sure you’ve selected everything (armature included) before clicking on the panda export entry in the menu.
  • Always export animations to separate files! (This makes many things easier.)
  • Test your animations with pview:
pview -cl model.egg -a model_animation.egg

In pview press “l” (small L) to enable shading, so that you actually see something.

I hope this helps a bit.

Thanks a lot. Disabling envelopes helped a lot :slight_smile:

However, I still have a strange problem. When I export my animations with YABEE, I can see them in pview, and I can also load and render them with panda3D using C code (pview is also written in C).

But, when I try to load it with python, using Actors, it only shows 1 part of the object. For instance the head of the character.

self.environ = Actor("models/FeelGoodComics_TomHanks.egg", {"walk": "models/FeelGoodComics_TomHanks-Anim0.egg"}) 


If I only load the model, it is rendered correctly, but when I load the animation using the Actor class, it only shows one model part.

Kind regards,

Try loading the model through loader.loadModel() and pass it as first arg to the Actor instead of the string.

model = loader.loadModel(“model.egg”)
actor = Actor(model, {“walk”:“walkanim.egg”})

Same problem…

I tried several models, for instance the one of … acter-rig/ and this issue seems to always occur.

Using pview, the model and animation is fine, but when I load it using Actors, it only shows 1 body part.

When I look at the animation.egg source code, it seems that the body parts are defined by tags, but I don’t understand why only one of these bundles get loaded.

When I add to my code, this is the output:

PandaNode Eye.L
  Character __Actor_modelRoot
    GeomNode  (3 geoms: S:(MaterialAttrib))

So it seems that only the Eye is loaded for the model I just tested, and indeed only the eye is rendered. For other models it renders only the head or only the hair, or…

This is my complete code at the moment:

class MyApp(ShowBase):
    def __init__(self):
        # Load the model.
	model = loader.loadModel("models/Guy.egg")
	self.environ = Actor(model, {"walk":"models/Guy-Anim0.egg"})



	plight2 = PointLight('plight2')
	plight2.setColor(VBase4(1.0, 1.0, 1.0, 1))
	plnp2 = self.render.attachNewNode(plight2)
	plnp2.setPos(0, 4, -1)

	plight = PointLight('plight')
	plight.setColor(VBase4(1.0, 1.0, 1.0, 1))
	plnp = self.render.attachNewNode(plight)
	plnp.setPos(0, -1, -1)

	alight = AmbientLight('alight')
	alight.setColor(VBase4(0.1, 0.1, 0.1, 1))
	alnp = self.render.attachNewNode(alight)

        self.setBackgroundColor(0,0,0, 1)


#'mov5/plane', duration=15.0)

app = MyApp()

So basically, it works if I load the animation using C++ (or pview), like this:

NodePath model = window->load_model(framework.get_models(), "models/Porl.egg");
window->load_model(model, "models/Porl-Anim0.egg");

But it doesn’t if I use python:

model = loader.loadModel("models/Porl.egg")
self.anim = Actor(model, {"walk":"models/Porl-Anim0.egg"})

Any ideas…?

Kind regards,

Ok, I found it…
When I Join the body parts first in Blender, the animation is loaded correctly in Panda3d.

Is there a way to only load in an animation and then load it in to the actor separately?

I am sorry to bother you, I ran into that same issue, the animation runs perfectly with pview but cannot be loaded under python…
I haven’t really understood what you mean by joining first in blender, could you expand on it please ?
I have attached my model and its animation, if anybody have time to have a look to it and give me feedback, I hope.

The warning I always get is :
:linmath(warning): Tried to invert singular LMatrix4.
I have looked into it but cannot think of any such related problem… (5.99 MB)

In the end, I solved my issue :

It seems that within the armature that we retrieve from loading a MakeHuman-developped 3D human model into Blender is flawded somewhere but as long as that somewhere is not included into the keyframe it is okay.

More specifically, previously, before inserting a keyframe I would select (by pushing the a-button ) every bones in my armature, while being in Pose Mode… And, now, as I only select the bones I have indeed apply modifications to, the warning is no longer visible and the animation run perfectly using the python API of Panda3D.

If some people were to want more details, here they are :
When importing the mhx2 model :
0) check “Override Exported Data”

  1. it is possible to check Face Shape
  2. In the rigging part : check “add Riggin” and choose MHX as a Rig type…
    Other possibilities exist, but this one is sure to zork apparently under Blender 2.78.
    For your animations : you can follow this tutorial :
    When exporting the model with your animations as actions, using the YABEE add-ons for Blender :
  3. In Object Mode, select everything in by pushing the a-button.
  4. File-> export -> Panda3D(.egg) : check “All actions ad animations”
  5. Check “separate animation files”
  6. You can keep the rest as default, for instance : No TBS generator Simple Tex proc., check “Merge Actor” and “Apply Modifiers”.
    And that is all, you are good to go and load your models and animations ad explained in Panda3D related tutorial/documentation.

Good luck in your projects, everybody !