Text nodes render quite slow. If i want to display a full screen of words the frame rate drops to 5fps. It is important to display long story lines in games is there any way to speed up text node renderings? I think the major cause of text nodes speed is the number geoms they generate using multiple texture stages.
Just to clarify - we’re talking about TextNode, not OnscreenText, right? (I just tested a screen full of OnscreenText and was getting 300 FPS on a cheapo video card.)
I’ve never used TextNode. What does it do?
OnscreenText is part of direct GUI case and i don’t like direct GUI. But its true Josh, i was wrong TextNode does render fast… it just does not render too fast in my gui! Which is a problem i must deal on my own i guess
OnscreenText is a thin layer on top of TextNode, which is the fundamental object used to render all text in Panda.
TextNode works by assembling a bunch of little Geoms together–one per letter–and then calling flattenStrong() on whole thing, to make one big Geom for the whole paragraph. It doesn’t use multiple TextureStages.
If your frame rate is suffering because your gui system is creating lots of little Geoms, see if there’s some way you can do a similar trick to flatten them together.
the problem with flattening gui is that it discards the clip planes attributes and creates a massive mess. I need to flatten strong inside each clipped region but if the gui changes every frame - its even slower.
Flattening isn’t supposed to remove any attributes, but I think we did have a bug a while back with the clip plane attrib. Have you tried this with the latest cvs build from Panda to see if the same bug is there?
But, to solve the bigger problem of how to keep your scene optimal when your gui might be changing every frame, well, this is the classic 3-D environment optimization problem. You have to figure out how to minimize the number of calls to flattenStrong() while also maximizing the amount of flattened geometry you render. It’s the same problem you have in the 3-D part of your scene as well.
Maybe this means you pre-flatten several different versions of your gui nodes (if they are just cycling through several different states). Maybe it means you make a distinction between static and dynamic gui nodes, and flatten only the static ones. Maybe it means you use the RigidBodyCombiner to do a flatten-like operation on the dynamic objects.
There are many different approaches to solve this kind of problem. Worse comes to worst, maybe it means you use a little less dynamism in your gui.
Another thing that comes to mind: if you’re relying on the clip plane attrib to cull out parts of the gui that aren’t visible, then flattening (even if it is working) may indeed cause you a performance penalty rather than a gain.
This is because Panda will cull objects that are entirely behind a clip plane, without even sending them to the graphics card at all. But when you start flattening objects together, then you end up with a single large object, some of which is behind the clip plane and some of which is in front of it. Now the whole thing has to get sent to the graphics card regardless.
Whether this results in an overall performance improvement or degradation is dependent on a lot of factors, including your graphics card and the complexity of the rest of your scene.
Yes clip planes break on very recent build. Right now i am thinking of flattening every thing inside a clip plane node that is not a clip plane while drawing it. Right now every button creates its own geom and its own text (couple of more geoms) i could create the button in its parent goem effectively flattening every thing on create ~ another good solution is making the GUI simpler because … well by now the gui is bloated any ways.
These geoms that it’s assembling: are they textured quads, or are they 3D models of characters?
They are textured quads. I know windows glut implementation could make geometric text but i dont think panda3d can.
The gui elements them selfs are also not simple quads (most of them are corners + tiled sides + tiled middle (geom tiled not texture tiled))