Don't mind the mess!
We're currently in the process of migrating the Panda3D Manual to a new service. This is a temporary layout in the meantime.
Performance Issue: Too Many Polygons
Even though modern GPUs can handle millions of polygons and vertex data takes little space in RAM, there is still a limit and it's not very difficult to reach it.
First thing you should make sure is that your performance issue is indeed caused by too many polygons. Even though modern GPUs can render millions of polygons in realtime, they still can't render more than few hundred meshes (Geoms) at the same speed. So you won't have problem rendering 300 polygons as 1 Geom in realtime, but you will torture your GPU if you'll try to render 300 Geoms, even if each has a single polygon. There are few ways to find out the Geom count and many solutions for lowering it which are discussed in the appropriate page.
Another issue might be using too many polygons on animated meshes (Actors). When you play an animation, Panda or your GPU need to calculate the new position of each vertex associated with a joint, even though the GPU will render the mesh at the same speed, the calculations done for the animation can get expensive themselves. You can easily find out the time spent on skinning with PStats:
Other factors might affect the performance which are not solely based on the polygon count. Is your mesh textured? is it shaded? Does it have the ShaderGenerator enabled on it or does it use custom shaders? Does it have normal/gloss/glow maps? Is backface culling enabled? These all can affect the performance.
If you are sure that your performance issue is caused by too many polygons, there are few optimizations you can do.
- The first obvious solution is to just make your models lowpoly or not use two polygons where you can use one. However, you should also note that per-vertex lightning uses vertices to shade the mesh, so a wall consisting of one single quad won't shade the same way as a wall consisting of multiple quads. You'll need to find a balance or use per-pixel lightning.
- You can have multiple levels of detail for your mesh.
- If you have a highpoly model, you can create a lowpoly version of it and generate a normal map from the highpoly model which you can assign to your lowpoly version in Panda. Normal mapping requires lightning and the ShaderGenerator or a custom shader.
- Sometimes it's possible to represent a mesh as a textured plane billboard.
- See if you can lower the far distance or far plane of the camera lens. Anything farther than the far plane of the camera lens won't be rendered. You can use fog to hide the clipping.