Hi guys, this is my second question.
I’m using Panda3D to create a visualizer for scientific data.
Now I have to draw a lot of cubes; the number goes from 5.000 to 10.000.
After reading manual and similar questions, I tried 2 ways to draw them:
- Instancing + Rigid Body Collector
- Creating a unique geometry containing all of them using the VertexWriter
I attached the example code I wrote, with CMakefile. It should compile fine if you wanna try it. I made my effort to comment it as much as possible, I think it’ll be understandable.
Both of them are quite slow, around 10 fps.
What am I doing wrong?
About the VertexWriter method, is there a way to create a huge vertex vector once, then tell Panda to use it only in the range [0, max) ?
By using rigid body collector it seems that I can change the properties of the single cubes (position, colors etc) but I can’t hide them anymore once added.
In the example I force the last 20 frames to draw only 10 cubes, but all the previous ones are still visible, even if I call hide() on them.
My main issue is that the data comes from an hardware sensor looking at the real world, and these data are refreshed frame by frame.
So I cannot make any assumption about what the next frame will look like, how many cube there will be or where they will be.
Basically each frame is a brand new one and I have to draw what I get.
I’m only interested in position, size and color of cubes, no other things like textures, lights and so on.
I also don’t care about detecting collisions between cubes (or between cubes and other stuff).
My understanding is that collisions are not checked by default, so I shouldn’t do anything particular to disable them, is it right? (The only collision I may be interested in is to allow selection by mouse click, but I think it won’t required in the end.)
I’ll have later to draw a similar number of billboard cards and other stuff, so I really need the cubes doesn’t drain all the time.
Any tips about how to speed up things are very welcome.
performance_test.zip (7.2 KB)