Questions on flattenStrong, flattenMedium

I am in the middle of developing a grass demo, which look like this:

And the grass is created by a grid of cross plane:

After I created them, I called flattenMedium and got a number of nodes reduced, but still there are quite a number of nodes left. In the manual, it stays “removes unneeded grouping nodes–nodes that have exactly one child, for instance, but have no special properties in themselves.”
What is the special properties referring to ?

Then I tried flattenStrong, only one node left. The result looks strange, the right front part of the grasses become shorter:

Can you explain the reasons behind and what is the best way to optimize this application ?

Thank you !

Have you seen this thread?


Thank you David, it should be the same problem.

But can you explain more about flattenMedium ?

flattenMedium is mainly designed to remove redundant, useless nodes. Generally, it won’t remove a lot of nodes, just a handful. By “special properties” it means nodes that are special-purpose nodes, like Camera or LODNode or whatever, as opposed to ordinary PandaNodes. It also won’t combine sibling nodes. It will only remove an ordinary PandaNode that has only one child and one parent, which is a perfectly useless node.

In general, you should use flattenMedium() on an overall scene, because it won’t interfere with the culling hierarchy (because it doesn’t combine siblings). That is to say, it will never make render performance worse.

You should use flattenStrong() on a group of nodes that will always be drawn together as a unit–a single model, or a single relatively small object in the scene. It will generally improve render performance by reducing nodes aggressively, but it can sometimes hurt performance by impeding cull effectiveness. When flattenStrong() combines nodes, it hurts Panda’s ability to cull out parts of the scene that are off-camera (because Panda has to send either all of a node or none of it), so if wide parts of the scene get combined together into a single node, it means all of the wide parts will have to be drawn all the time. Depending on your graphics card, and the nature of the different parts, this may result in a performance improvement or a performance penalty.


Thank you for the explanations, it is very helpful.