Culling Models

Is there anyway I can have the camera cull a single model?

I want to use this for grass. If I set the culling just for the grass, it won’t render if its to far away.

You can create an explicit clip plane that cuts only the grass out. Something like this:

plane = Planef((0, -1, 0), (0, 0, 0))  # XZ plane
planeNode = PlaneNode('planeNode', plane))
planeNP = base.camera.attachNewNode(plane)
planeNP.setPos(0, 1000, 0)  # or wherever you want it
grass.setClipPlane(planeNP)

David

I tried that, and there seems to be no performance improvements. For example, I get 45 fps looking at a hill covered in grass. If I turn 90 degrees to an area without grass my fps goes back up over 60. If I turn culling on for the grass, and set it to only see grass thats under 20 units away, and then look at that hill my fps goes back gown to 45. If I turn the grass off completely I get a perfect 60 fps over the whole area.

Culling isn’t the only performance tuning you can do. Rule of thumb performance performance should be looked in order of “code > geom count > shader > overdraw” But culling the grass you are only looking at overdraw, which is the last and least important performance optimization.