Clipping

How is it done in panda? I need to render only visible faces. much like in this post [Minecraft clone graphics poor performance) any tutorials on it?

I think you need to be more specific. Which faces do you want to clip, exactly? And do you mean to want to do this work on the CPU, to avoid sending the clipped geometry to the graphics card in the first place (which would be called “culling”), or do you mean you want to do this work on the GPU, to avoid some rendering artifact that would be visible if you didn’t clip them?

David

I want to keep it from rendering non visible faces or faces that are being hidden by other faces (not render a ball that’s behind a wall type thing) I noticed panda already does thy to an extent as I made a 10 X 500 long walkway made of cubes and web I looked down the walkway it dropped to about 3 fps but when I look the other direction with the walkway not visible it goes up back to the 60 fps limit. Essentially I’m just looking for a way to optimize the code to allow levels made up of larger amounts of cubes.

Thanks for the speedy reply as always David :smiley:

You are talking about culling, then. This is the process of determining which objects need to be sent to the graphics card for drawing, and which objects may be omitted because they won’t be visible anyway. The purpose of culling is to improve frame rate by reducing the number of objects that need to be sent to the graphics card.

This is different from clipping, by the way, which refers to cutting the edges of polygons that cross at the edge of the screen or some other predefined plane.

Panda performs view-frustum culling automatically, which means it removes objects whose bounding volumes are entirely outside of your view frustum (the shape of the lens’ field of view). However, it does not perform occlusion culling, so objects that are behind a wall but still within your view frustum are still sent to the graphics card.

Occlusion culling is a difficult thing to do in general. The problem is that determining what is behind a wall is actually very difficult to do reliably, and unless you are careful you might spend more time in the culling operation than you would simply sending the objects to the graphics card. So often, people use other solutions to improve frame rate that don’t rely on occlusion culling.

But it should be pointed out that you can create an OccluderNode that corresponds with your wall geometry. This will automatically cull out objects that appear entirely behind the OccluderNode’s polygon.

Still, you might do better just to flattenStrong() some of your objects together, so there are fewer individual objects in your scene in the first place. This will actually make culling less effective, but it often results in a performance boost anyway because the cost per object is so heavy, so having fewer objects is often a win.

David

Thanks again :smiley: I like both the flattenStrong() and occlusionculling. I"ll mess around with it once I get home. Thanks again David :smiley:

Works great! can i also flattenStrong() collisionGeometry like collisionCubes()?

Yes, but it’s less likely to help performance, and may actually hurt performance. Collisions benefit more from having a well-organized hierarchy of surfaces (like an octree), instead of grouping many surfaces together.

David

aah, i thought it would help performance as i would only have 1 collision solid compared to 10,000 or more XD and that would be the collision solid for only the map, there would be others for, say, mobs or items.