Problems with flattenStrong

Hello,

I have a multipart actor in a game that appears lots of times. The problem is that I’m getting low frame rate in 240 actors (the target is near 5000). Running pstats I’ve seen that the bottleneck was the Draw thread: too many geoms.

Every multipart actor has at least 7 geoms (one for every part), so I tried to merge into one using flattenStrong, but flattenStrong only merges the GeomNodes into one and leaves the geoms.

Here is a simplified version with only two parts:

nodePath.ls()

PandaNode Armature T:(pos 0 10 -2.5)
  Character __Actor_body
    GeomNode  (1 geoms: S:(MaterialAttrib TextureAttrib TransparencyAttrib))
  Character __Actor_helmet
    GeomNode  (1 geoms: S:(MaterialAttrib TextureAttrib TransparencyAttrib))

nodePath.flattenStrong();
nodePath.ls();

PandaNode Armature
  Character __Actor_helmet
    GeomNode  (2 geoms: S:(MaterialAttrib TextureAttrib TransparencyAttrib))

I’ve used egg-palettize to mix the textures into one but it hasn’t given effect.

Finally I’ve read that it is also needed that every geom has the same render state.

gnp = nodePath.find('**/+GeomNode')
gn = gnp.node()
for i in range(gn.getNumGeoms()):
  print "Geom %s:" % (i)
  print gn.getGeomState(i)
Geom 0:
MaterialAttrib:Material Material.002 a(0.8 0.8 0.8 1) d(0.8 0.8 0.8 1) s(0 0 0 1) s12.5 l0 t0
TextureAttrib:on default:smisc_palette_4amlc_1
TransparencyAttrib:dual

Geom 1:
MaterialAttrib:Material Material a(0.8 0.8 0.8 1) d(0.8 0.8 0.8 1) s(0.00148963 0.00148963 0.00148963 1) s12.5 l0 t0
TextureAttrib:on default:smisc_palette_4amlc_1
TransparencyAttrib:alpha

getGeomState prints this, but I have tried to edit the .egg files to set TransparencyAttib and MaterialAttib into the same, but has no effect.

What I’m doing wrong?
Thanks in advance and sorry for my English :blush: