I’m relatively new to Panda3d, but it’s a great game engine. I’ve just populated my scene with about 13,000 textured cubes and the framerate is around 20 frames per second on my Intel integrated graphics. I achieved this, because I used a RigidBodyCompiner - so this is great.
Could we enhance the performance further? I’m developing some Minecraft-like Voxel game. So all the cubes below the ground wouldn’t have to be rendered. I’ve seen this Culling Node , but how would I apply it to my current scene? I expected some automatic mechanism which detects which areas are visible and which not. However, as to my understanding, you have to provide four Vectors which make up a plane. But a plane can only cover ONE side of a cube. What if I look at it from a differen angle? Will I have to create 6 culling nodes, one for each side?
Are there more common techniques for improving the rendering performance (textures are already very lightweight and I’m not yet dealing with any lighting or shaders).
It would be great if you could provide a code sample (at least for the culling) so that my questioning about how to apply this to 13k cubes, becomes solved by looking at how you did it.
Thank you in advance!
Hi, welcome to the forums!
Making a voxel-based game can be challenging. The best way to go about this is to create a custom geometry generator that generates parts of the world in large batches, rather than having a Geom per block. This will be more efficient than first creating 13k cubes and then having the RigidBodyCombiner flatten that back down to a reasonable number of Geoms.
For textures, you would best use a single atlas containing all the textures, and use UV coordinates to sample the correct part of that texture. This prevents blocks with different textures from needing to be in separate Geoms.
PS. If you’re adventurous, I have a branch on GitHub called
traversal-optimizations that has some radical improvements for culling out nodes that are out of view (in my scene with 250k nodes, cull time went down from 60ms to 2ms). You could try out that branch and see how much that improves things for you. However, it will likely only help if your scene has a large number of nodes, which isn’t a problem you should be having in the first place.
Thank you! I will look into these options and fiddle around with the Geoms and with your branch - sounds very promising .
I’m so glad for the great community here - I’ve seen you answering so many questions for more than a decade.
P.S.: I’m having another little problem with textures which is unrelated to this thread, so I’ll open a new one.
Sounds interesting! Can it be installed without building on my machine?