Performance Problem with LineSegs

I’m in the development of an RTS game using the Panda3D engine and we got some performance problems in case of using LineSegs to show the unit border on selection (simpleness a sqare, drawing around the unit).

If we select a bunch of units (>50) and the border with LineSegs is rendered, the perfomace drops of to 50% and more. It seems to me that the performance drops linear to the amount of LineSegs.

The LineSeqs are generated on initialisation of an unit and on default are set to hide() in the scenegraph. On selection we set them to show().

I made a test, to show, that not our game (events, notification ect.) are involved in the performance problem: I rendered our scene (rather simple scene with some models and about 10000 polygons) without any user input and includet there 100 sqares (combined LineSeqs) and saw the same perfomance break down. I also tried it with a simple plane model and a transparent texture with a not transparent sqare border and got a better performace (but only ~10%, which is not satisfying).

Had some else problems with this? Is there a workaround or did I something wrong?

Thanks for your reply

since your triangle count is rather low. i’d guess the usual suspect would be the node-count. at some point gpu’s choke when dealing with too many individual nodes. usualy you’d want to have less than 300 nodes visible onscreen at any given time.

panda provides a number of methods to improve the performance, those are most effective when you have very few triangles per object (like you do).

for now: use pstats to verify what exactly takes so much time. also check the number of visible nodes within view. if you have too many nodes, then rigidBodyCombiner may be an option for you.

thanks for your quick response. And yes the number of nodes is the point :wink: