unnecessarily merged vertices

last days i had a hard time fining out why my animations look strange - now i found the reason for sure: panda’s flattening.

while loading a model -or in my case, an actor-, panda automatically optimizes the model and tries to decimate the vertex- and polycount. nothing bad about that, but sometimes you need double vertices which belong to different faces.

Here’s an example:
nemesis13.de/tmp/test.egg - two squares side by side. one half is animated by an armature.
load and play it with the following code:

import direct.directbase.DirectStart
from direct.actor.Actor import Actor
from pandac.PandaModules import *

np = Actor('test.egg')


base.accept("f1", render.ls)
base.accept("a", np.play, ["right down"])

plight = PointLight("dlight")
alight = AmbientLight("alight")
plnp = render.attachNewNode(plight)
alnp = render.attachNewNode(alight)
plight.setColor(Vec4(1.0, 1.0, 0.8, 1))
alight.setColor(Vec4(0.0, 0.0, 0.2, 1))
plnp.setPos(10, 10, 20)


(the light at the end is necessary, you’ll see why)

run the script, zoom out and rotate the camera a bit to see the plane from 3rd person view and press ‘a’.
you’ll notice, that the shade changes at the right side, nothing more:

in real it should look like this:

the reason is visible if you press ‘F1’. the two planes have been merged into one geom (which is one single, connected mesh)

i tried the following options without any results already:

  • prc options egg-flatten 0 and egg-unify 0
  • the actor argument flattenable=False
  • actor function postFlatten() – causes a crash when playing any animations afterwards

so… is there any special top secret option that i have overseen?

the following egg file shows it even better:

load it with the same code as above and change only the test.egg to test2.egg

Ah, this is a bug I’ve seen before. The triggering problem is that only one of your quads is assigned to a joint. Try creating a dummy joint, even one that never moves, and assign the other quad to that one.

Granted this is indeed a bug in the egg loader, but making sure that all of your polygons are assigned to joints should be an easy workaround.


doesn’t help

Really? Can you post the updated egg file?

Of course, another workaround is to ensure that you generate the egg file in a pose that doesn’t have the vertices in exactly the same place.



files included:
test.egg – same as above but with both quads rigged and animated
test2.egg – with subdivided faces
pview.py – example setup

blend files (blender project files) for both eggs are also included

any progress on this? this bug is pretty annoying :-/

my workaround is a gap of 0.0001 between the vertices. barely noticeable for the player, but seems to make a huge difference for panda

It turns out to be difficult to fix. Here’s a relevant comment from the C++ source (for “Group membership”, read “Joint membership”):

The comment notes that, with the correct behavior, “vertices will tend to fly apart when the joints animate”, which is of course exactly what you wish to happen in this case.

So, although it’s certainly possible to fix this bug, it won’t be a trivial fix; and I’ll have to move it down on my priority list, especially because there are workarounds available. Sorry about that. :confused: Hopefully I’ll be able to get back to it eventually; or anyone else with sufficient available time is welcome to take a whack at it in the meantime.


thank you very much for investigation.
i think i can live with a 0.00001 units big gap between the vertices :slight_smile: