depth buffer probs

sorry. its me again.

i got some probs related to the depth buffer i think.
i draw a scene in with vastly different scales, so its hard to fit the depth buffer. i set up a mechanism which moves the far/near clip planes via glFrustrum according to the position of the nearest and farthest objects. now i discovered one/two problems:

-first, sometimes far away geometry looses some polys as you can see here:
http://www.hirnsohle.de/pics/screens/depthBufferProblem.jpg
the “sun” on top right has some holes which shivers over their surface if camera/object is slightly moved. some polys, depending on transform, are not drawn i guess.

-second, the far plane only seems to clip the geometry (mostly not useful) bot doesn’t scale the depth buffer, which seems only affected by the near plane. (i observed that fact as the “holes” mentioned above appear at ever the same distance of the NEAREST object, where i set the near clipping plane to.

now two questions arise:
-is it possible to control the depth buffers NEAR and FAR points to use it in full?
-if not, is it possible to fix the holes-bug? in fact, the “sun” is drawn over glClear-background, so all their polys could render, even if they are almost infinite away?? maybe inf>inf gets false with depth test? id like to tell gl to overwrite in “unclear” depth situations instead of leaving holes…

many thanks
Paul

[QUOTE]Originally posted by dronus:
[QB]sorry. its me again.

-second, the far plane only seems to clip the geometry (mostly not useful) bot doesn’t scale the depth buffer, which seems only affected by the near plane. (i observed that fact as the “holes” mentioned above appear at ever the same distance of the NEAREST object, where i set the near clipping plane to.
[\QB][\QUOTE]

Well, nearly, but not really. The precision of the depth buffer is much more stringly affected by the near cliiping plane than the far one, but it doesn have an influence. See Learning to love your Z-Buffer for an explanation.

[QUOTE]
[QB]
now two questions arise:
-is it possible to control the depth buffers NEAR and FAR points to use it in full?
[\QB][\QUOTE]

You do that, you just don’t notice.

[QUOTE]
[QB]
-if not, is it possible to fix the holes-bug? in fact, the “sun” is drawn over glClear-background, so all their polys could render, even if they are almost infinite away?? maybe inf>inf gets false with depth test? id like to tell gl to overwrite in “unclear” depth situations instead of leaving holes…
[\QB][\QUOTE]

It’s perfectly clear for GL. :wink:

The best way to get around this is to split up your scene into near and far parts, and draw both of them independently with optimized near and far ranges with only clearing depth in between. This breaks if you can’t find a good separation between near and far, but your scene doesn’t like that’s a problem.

Yours

Dirk

Thanks for the answer.
rendering in “slices” sounds nice for very deep scenes.
but thinking about it, i figured out my point was that i’m okay with the “sun” beeing “infinite” away and not able to correctly interact with other even more far away geometry…
so i wonder if i could make gl render it far away as a clear depth buffer is, and that without holes. (and without having to manipulate rendering of “sun” in any special way)

my opinion is that if “sun” is not fighting against other geometry but only the empty buffer it should be allways at front. but that seems wrong :frowning:

btw. i experimented with “depth func” GL_LESS and GL_LEQUAL where interchange of them seems to translocate the problem a little bit in means of possible nearest near plane… but not solving it.

many thanks anyway
Paul