Can you export combined armature animation and blendshapes for the same single-part actor?

Good day. I’m interested in creating a single part actor with armature animation, where the actor’s vertices are both able to be manipulated via skeletal animation as well as by blend shapes.

In order to illustrate my question, I hope this hypothetical situation sheds light on what I am trying to achieve:

Let’s say we have a single mesh, a regular man with a regular skeleton, who we will call John Panda. In the most common animation workflow, we pack John neatly into a john.egg, and we give him john-idle.egg, john-run.egg, etc. separately. So far so good.

However, Panda and its actor system also supports blend shapes. We can for example export a keyframed John model from blender where he has no armature anymore, but his mesh has a shapekey where he turns into a sphere. This also works, if in a 30 frame animation we animate John interpolating from his T pose form into his sphere form, we can export this from blender and see it with pview, calling something like: pview john-blendshape.egg john-blendshape-tosphere.egg and voila, we now have John Panda morphing with a blendshape just as keyframed in blender.

But here is where the problem arose for me: When I tried to make a model have a blend shape (or ‘shapekey’) as well as an armature, pview froze solid. Stuck on busy, and hanging to no end.

To verify it wasn’t just pview doing this, I recreated the same scenario within a new, full, panda application. John Panda with his armature loaded, so did John Blendshape, but upon trying to combine the two, John Pandashape whenever called as an actor would instantly cause the application to begin hanging indefinitely. No crash, no error, nothing.

Now I believe I understand where I went wrong. From my understanding, I believe blendshapes effectively give the actor a new joint that can be exposed and controlled programmatically, which is all well and good. However, giving an actor that is already parented to an armature (As blender has a reverse hierarchy where the mesh belongs to the armature rather than vice versa) and trying to export the armature and mesh together while the mesh has a shape key, I theorize at least the way I am doing it might be trying to give John Pandashape two separate skeletons, and Panda doesn’t like it.

The nuances of how specifically the animating can be done can come later, but the first problem I need to figure out is: Is it possible to combine the two capabilities, and if so, how can I get John Panda into a Panda program so he successfully loads into panda with both a skeleton and a shape key, so both can have an effect at the same time?

I’m sort of trying to get a similar effect to like a player character from an RPG that has a character creator, or a base humanoid system that could randomize appearances through various blend shapes. Their body shape might differ to varying degrees, but all the animations still work.

I’d also like to state upfront that I am aware of the multipart actor capabilities of Panda, but at this time I would like to try to avoid using such a system in favor of a unified mesh. The reason being is that I would like the capability to actually have the actor change shape while being observed, and blend shapes allow for smooth interpolation between the base and modified shape.

If we had John Panda with a weakling and ripped shape, we might want him to smoothly interpolate from weakling to ripped over time, or vice versa. In such a case, I believe trying to achieve this effect with a multi-part setup would be inadequate. My reasons for thinking as such are twofold:

  1. I can see being issues are either it would have to be swapping instantly from weakling parts to ripped parts, or alternatively
  2. There would have to be a dozen preset parts that the program would need to constantly swap between.

All help is appreciated, and I do hope I’ve made myself clear to explain the issue, especially as I am more familiar with the animation package side of things (Blender and its functionality) than I am with Panda3D. I’m half hoping I am simply missing something obvious in the export process. Thank you!

I am not sure how things work on the .egg side of things, and if they even support shapekey animations? I have only experience with shapekeys using gltf files (loading them with panda3d-gltf). Is there any reason for you to prefer eggs?

The blender interface for shapekey animations is a bit weird, it is in that dropdown menu where the action editor is at as well. You can animate the shapekey values in the action editor, and blender will animate the values, but they won’t export. When doing it in the shape key editor Blender should export the animations correctly.


One peculiarity that I am not sure is already fixed is that the first frame of a shapekey animation should be 0, or the exporter makes a mess of things (model looks like it exploded).

Other than that shapekeys should work like any other joint in the Character. You can Actor.freeze_joint() them into various positions for making procedural animations (or lerp them from 0 to 1 in a task or interval for a smooth transition) and we can Actor.play() and Actor.setBlend() shapekey animations just like any other character animation.

Actor.makeSubPart() can be used to isolate certain joints for certain animations for more precise blending (f.e. only legs are used for the walking animation, leaving the rest of the armature available for blending in a hand waving animation). You might want to use that to isolate the shapekey joint so it doesn’t interfere with any other animations playing. But I am not sure if this is even required.

I can write you a little example later today but ironically I am having a bit of trouble with panda3d-gltf (blender updates breaking things again?)

If you can share code and blend file I can also take a look if you so desire.

Hey, thanks for replying. The reason I’ve been preferring to use .egg files other than the fact that my other projects utilize .egg and .bam files as resource storage is mostly because i’ve been learning Panda under the pretense of .egg being the preferred format for Panda projects, as its the format discussed in the Panda3D lectures and a good deal of the documentation.

I don’t have much experience with .gltf files, but I’d like to have my model on its own, as well as separate files for each animation to apply to the model, which is the way the .egg format is typically set up like.

While I would love to share the resources I have been using as an experiment, the forums dictate that I may not upload attachments yet.

Here is the structure I have though:

MorphSphere.egg (Cube that morphs into sphere, no animation)
MorphSphere-ToSphere.egg (Keyframed blendshape that animates the cube to turn into a sphere, with a wobble at the end)

When I use pview MorphSphere.egg MorphSphere-ToSphere.egg it loads fine, and starts playing the animation, but if I try to pview just the model egg, it gets stuck on loading, the same as if I try to load it as an actor with its assigned transform animation. It’s like the model needs the blendshape animation to play with it at the exact same time its invoked, like it doesn’t have a rest pose otherwise.

An example would be most appreciated