NVIDIA's magic depthbuffer

I have a problem that I think is related to a driver depthbuffer problem on NVIDIA hardware (haven’t got any ATI cards to test on).

Here’s a screenshot of my app:
and here’s the corresponding depth buffer “screenshot”: http://odense.kollegienet.dk/~naur/depth_screenshot0.png

Now, picking returns bogus depth values and the water is flickering near the far plane where it meets the sky. This flickering is happening even when the view position is constant.

Now here comes the magic part: The very action of taking the depth screenshot above instantly fixes the problem! Picking works, there’s no more water flickering at the far plane, and here’s how the next shots looked like:
http://odense.kollegienet.dk/~naur/screenshot1.png http://odense.kollegienet.dk/~naur/depth_screenshot1.png

The problem shows under these conditions

  1. In win32, in fullscreen mode, 24 bit color buffer, 24 bit depth buffer
  2. In linux, fullscreen mode and __GL_SYNC_TO_VBLANK set. 24 bit color buffer, 24 bit depth buffer

It won’t show in windowed mode or when vsync is disabled on linux. So the problem is restricted to page flipping modes only.

I have a modified nehe application that shows the picking problem in fullscreen mode, but not in windowed mode:

In windowed mode, you can place the dot on the quad when clicking the mouse but in fullscreen (switch with F1), you can’t. In fact, only every 20th or so click hits the right spot.

I hope someone can help me out here.

  • elias

You realize that picking is implemented via a software renderer, yes? And, because of that, you cannot guarentee invariance between the hardware rendered portion and the software portion.

maybe, but picking is just one of the problems. If you lok at the depth shots, the first is entirely filled with one color, while the other looks more like a real depth buffer. And both of the shots are taken in normal (not picking) render mode.

  • elias