PDA

View Full Version : Y does 32-bpp cure Z-buffer fighting snafu?



06-10-2002, 10:07 AM
Just looking for a lucid explanation or guesstimate as to why my chronic z-buffer fighting problems clear when my Windows desktop is set to 32-bit colour depth.

harsman
06-10-2002, 11:16 AM
Because you're card uses more bits for the depth buffer. Push your near plane out. And do a friggin search, this has been explained in detail at least a hundred times here previously.

secnuop
06-10-2002, 04:34 PM
Originally posted by harsman:
Because you're card uses more bits for the depth buffer. Push your near plane out. And do a friggin search, this has been explained in detail at least a hundred times here previously.

To explain a little more clearly...

I'm guessing that you're asking for a depth buffer but you're not asking for a specific depth buffer bit depth. It just so happens that the depth buffer bit depth you're getting is different depending on what your desktop color depth is. When you're at 32bpp you're getting a 24 bit depth buffer, and when you're at 16bpp you're getting a 16 bit depth buffer.

There are a couple of solutions to your problem. You could, as harsman kindly suggested, push your near plane out a bit more (or pull your far plane in). This effectively gives you more bits of z-precision.

You could also specifically ask for a 24 bit depth buffer regardless of the color buffer bit depth. Then (assuming you get it) your results should be the same for both 16bpp and 32bpp desktop color depths.

06-10-2002, 05:00 PM
Grats,

As it happens, I can't push/pull my near and far as I have a model placed within a large skybox.

So, 24-bit depth buffer seems to be the way to go!

Thanks again ('cept for harsman who can, um, kiss my grits).

zed
06-10-2002, 09:08 PM
>>kiss my grits<<

your what, what a minute i dont wanna know

>>As it happens, I can't push/pull my near and far as I have a model placed within a large skybox.<<

it doesnt matter how big the skybox is (ie 1cm wide or 1lightyear wide will look the same size for the viewer) cause normally u draw it first with depthtesting disabled

harsman
06-11-2002, 12:54 AM
I think I'll pass on kissing your grits, but I'll give you a tip. secnuop said:

You could also specifically ask for a 24 bit depth buffer regardless of the color buffer bit depth. Then (assuming you get it) your results should be the same for both 16bpp and 32bpp desktop color depths.

Actually, some hardware doesn't support more than 16 bits of depth precision when using 16bit colour. You really should make your program work with only 16 bits of depth precision, it's sufficient for the majority of situations. Like zed said, the skybox is so far away that it doesn't change size relative to the viewer. Draw it centered at the origin affected by viewer rotation only. And draw it without writing to the depthbuffer (nothing should be behind the skybox anyway, right?). That way you can still push your near plane out and enjoy the benefits of spending your depth buffer precision in a better way. Try this page (http://www.sjbaker.org/steve/omniv/love_your_z_buffer.html) for a good explanation of z-buffer precision issues. And search the forums, you'll find lots of great threads on skyboxes and depth buffer precision.

06-11-2002, 11:26 AM
My original question had more to do with the wiring of colour depth <> depth buffer.

As Paul Atriedes said: "Is there a relationship between the worms and the spice?"

Thanks again to all; even harsman ;-)

nickels
06-11-2002, 12:42 PM
And don't forget that giving up a few feet in the near plane is just as good as giving up a few hundred thousand in the far plane. The buffer is much more stressed by the near plane than the far...