reseting the depth buffer mid frame

in my game i have planets rocks and all this other stuff. I draw planets first but they still clip geometry some times because they are still in the depth buffer. Is there a way to reset the depth buffer mid frame? After say the “background” bin has been drawn? A hakish way to do it is to draw plane in front of whole screen with depth test off and make sure its depth value is far as possible. Any suggestions?

You can do this.

Panda’s rendering loop has quite a few clears in it:

for all windows by window sort order do:
  if win.clear_depth then clear depth buffer of entire window
  if win.clear_color then clear color buffer of entire window
  for all displayregion by displayregion sort order do:
    cam =
    if cam.clear_depth then clear depth buffer of displayregion
    if cam.clear_color then clear color buffer of displayregion
    render camera into specified region of window

So basically, all you need to do is create a new displayregion in the window with a new camera, and set the camera to clear the depth buffer of its region.

Here’s a recent thread that shows how: