I know I’ve brought this up before (see https://bugs.launchpad.net/panda3d/+bug/913658 ), but I’m still stuck. I have some models I want to flatten. Even if set every RenderState on every node and every geom to an empty RenderState, FlattenStrong only takes me from 21499 geoms to 589. It successfully reduces the model to a single geom node, but thats way too many geoms! It should be 2 (one for the lines, one for the triangles). I’ve tried removing all the lines, and it does not solve the issue.
Before flatten (after removing all renderStates):
28796 total nodes (including 0 instances); 0 LODNodes.
6732 transforms; 0% of nodes have some render attribute.
21499 Geoms, with 21499 GeomVertexDatas and 3 GeomVertexFormats, appear on 21519 GeomNodes.
639320 vertices, 634375 normals, 0 colors, 437750 texture coordinates.
GeomVertexData arrays occupy 28872K memory.
GeomPrimitive arrays occupy 2604K memory.
38381 GeomVertexArrayDatas are redundant, wasting 7184K.
18026 GeomPrimitive arrays are redundant, wasting 2112K.
464874 triangles:
148314 of these are on 68157 tristrips (2.17606 average tris per strip).
316560 of these are independent triangles.
3240 lines, 0 points.
36 textures, estimated minimum 26301K texture memory required.
After flatten:
2 total nodes (including 0 instances); 0 LODNodes.
0 transforms; 0% of nodes have some render attribute.
589 Geoms, with 326 GeomVertexDatas and 2 GeomVertexFormats, appear on 1 GeomNodes.
639320 vertices, 639320 normals, 0 colors, 575005 texture coordinates.
34468 normals are too long, 176977 are too short. Average normal length is 0.871142
GeomVertexData arrays occupy 32953K memory.
GeomPrimitive arrays occupy 2737K memory.
3 GeomVertexArrayDatas are redundant, wasting 141K.
46 GeomPrimitive arrays are redundant, wasting 139K.
464874 triangles:
0 of these are on 0 tristrips.
464874 of these are independent triangles.
3240 lines, 0 points.
0 textures, estimated minimum 0K texture memory required.
And node.ls() produces:
ModelRoot rest_FromDae.egg
GeomNode SketchUp (589 geoms)
Here is a smaller example (this time with the lines removed):
1253 total nodes (including 0 instances); 0 LODNodes.
232 transforms; 0% of nodes have some render attribute.
1019 Geoms, with 1019 GeomVertexDatas and 2 GeomVertexFormats, appear on 1019 GeomNodes.
31012 vertices, 31012 normals, 0 colors, 29400 texture coordinates.
GeomVertexData arrays occupy 1678K memory.
GeomPrimitive arrays occupy 99K memory.
3752 GeomVertexArrayDatas are redundant, wasting 1497K.
993 GeomPrimitive arrays are redundant, wasting 95K.
18678 triangles:
18150 of these are on 8208 tristrips (2.21126 average tris per strip).
528 of these are independent triangles.
0 textures, estimated minimum 0K texture memory required.
2 total nodes (including 0 instances); 0 LODNodes.
0 transforms; 0% of nodes have some render attribute.
16 Geoms, with 16 GeomVertexDatas and 2 GeomVertexFormats, appear on 1 GeomNodes.
31012 vertices, 31012 normals, 0 colors, 30402 texture coordinates.
0 normals are too long, 78 are too short. Average normal length is 1
GeomVertexData arrays occupy 1708K memory.
GeomPrimitive arrays occupy 104K memory.
21 GeomVertexArrayDatas are redundant, wasting 348K.
7 GeomPrimitive arrays are redundant, wasting 47K.
18678 triangles:
17036 of these are on 7725 tristrips (2.20531 average tris per strip).
1642 of these are independent triangles.
0 textures, estimated minimum 0K texture memory required.
ModelRoot rest_FromDae.egg
GeomNode SketchUp (16 geoms)
It should be exactly 1 geom, but instead its 16! Well, maybe 2 geoms (one each of the GeomVertexFormats)
The model in question for this smaller example, and the source code to strip renderstates, lines, and flatten it is here:
http://craig.p3dp.com/Misc/flattenIssue.zip
This has been killing my frame rates for the last year or so, and its getting kinda annoying to have 3-8 fps now that my maps are geting bigger. Even with proper chunking and LOD, each chunk at each LOD has like 10+ times the geoms it should.
Any ideas on how to fix this, or why it happens?
Thanks!