Slow Performance <Solved>

Panda3d 1.8.1
I’m using linux.
Tested on three different machines with the same results. (High end and low end machines)

If I display 400 models on the screen Panda3d’s performance drops dramaticly… It does not matter how complex the models are, if its a bunch of planes, or a bunch of Panda’s panda models the fps is the same.

Blender’s BGE with the same setup can display 2,000 of the same objects, (all even being animated), and still get 60 FPS.

Am I missing a performance setting, or is this normal for Panda?

Running this code causes my intel laptop to run at 20 FPS, desktop with GTX 570 to run at 50 FPS.

from direct.showbase.ShowBase import ShowBase

class MyApp(ShowBase):

	def __init__(self):
		base.disableMouse(), 10, 40), -90, 0)

		model = loader.loadModel("smiley")
		for x in range(20):
			for y in range(20):
				node = render.attachNewNode("instance")

app = MyApp()

This is normal for any game engine that does not automatically merge objects together.
See this section of the manual:
Generally you should keep the number of separate objects on screen around 200 or less to have a good frame rate. You’ll be able to find more detailed information on why this is the case by searching the forum, but suffice to say this is a limitation of how modern hardware works and is not a problem with the engine.

Thanks for the responce Teedee,

I had already tried using render.flattenStrong() without any difference in performance. However I found by doing, render.clearModelNodes() then render.flattenStrong(), made the difference and I was able to display even greater amounts of models and still get 60 FPS in Panda.

(Don’t get me wrong, this is not a bashing Panda3d. I love the engine and want to use it. I just want the best performance out of it.)

In Panda3d when displaying 900 simple planes unanimated, (without using flattenStrong), it cuts my frame rate down to 30FPS. In blender’s BGE I can display 2,000 simple planes each being animated with their own animations and still get 60 FPS.

Am I missing some performance tuning advantages that can make a difference in this situation?

flattenStrong will by default not work across instances of a model. You have to use clearModelNodes on the result of loader.loadModel before it will work. Then, you should see your performance increase dramatically.

You can in fact use hardware instancing to optimise it further, but this opens a big can of worms; it requires you to write your own shaders, and take care of culling volumes yourself.

1 Like

I’m not sure that it works with skeletally-animated models (such as Actors), but RigidBodyCombiner may also help in cases in which you want the objects to move independently of each other.

Thanks for the replies, you have given me some options that helped me solve my issue.