Z-Buffer FAQ?

Jimmers

Newcomer
Is there a good explanation of z-buffer anywhere on the net?

If not, here's what I'm asking about. I use RadLinker to get program specific driver settings. There's a pull down menu titled "Z-Buffer Depth", and it has the following options.
- 16
- 16,24
- 16,24;8 bit stencil
- 16,24,32
- 16,24,32;8 bit stencil
What do there different options do? Are these referring to FP16, FP24, FP32, etc?
 
Depth precision = Z/W-Buffer.

Radeon's don't have a W-Buffer though.

It has nothing to do with color precision.

Stencil buffer is used for shadows/reflections.

Some games have an option for 24bZ/32bZ.
24b Z Buffer is the highest accuracy you can achieve, the extra 8-bits are for the stencil buffer.

That doesn't apply for all cards, eventually we will see a 64b Z-Buffer + 24b stencil. ;)

I'm just assuming you have an R3xx/X8xx.
 
A link to Z-buffer

Edit:

K.L.L.E.R said:
24b Z Buffer is the highest accuracy you can achieve, the extra 8-bits are for the stencil buffer.

For what tech/cards are you referring to for 24 bit the highest accuracy? :?
 
The short of it:
A z-buffer is a buffer that stores the depth (z) value of each pixel on the screen. This allows triangles to be sent to the GPU in any order, with those behind already-rendered triangles being thrown out, and those in front being rendered, updating the depth stored in the z-buffer at the same time.

The different numbers associated with the z-buffer are precision values. More precision means objects can get closer before the hardware has a hard time figuring out which one is in front. When they get too close for the chosen precision, you'll typically get flickering. Ever seen a decal (explosion blast or blood) in UT or some other game flicker? Particularly when viewed from a large distance (i.e. through a sniper rifle sight)? That's a z-buffer error.

The W-buffer basically acts like a z-buffer, but has a different spread of where the errors occur. Stencil buffers are typically connected to the z-buffer, and can be used for any number of effects. They have the same characteristics as a z-buffer (i.e. they can be used to accept or reject pixels on a per-pixel basis), but can be modified in many ways. One way is to render shadows, where the stencil buffer is used to determine whether a pixel is in shadow or not.
 
I'm pretty sure no consumer card currently supports higher than a 24-bit z-buffer. I do know that 3DLabs supports a 32-bit z-buffer, but consumer cards elect to pack the z- and stencil-buffers into one to save performance, which limits the possible precision.
 
Chalnoth said:
It's just 24-bit z and 8-bit stencil.

Thanks for clearing that up...the last PC card I owned was a 3Dlabs which had 32 bit z. Thought the industry had moved onto 32 bit z by now. :)
 
Nope. I think GPU manufacturers have decided the performance hit of separating the stencil and z-buffers isn't worth the increase in visual quality for games.
 
There are also options for integer or float depth buffers. A float buffer using 1-z is very close to a w-buffer without the problems.

Many modern cards support very few actual depth buffers options any more.

D24S8 24 bit integer depth, 8 bit stencil
D24X8 24 bit integer depth, 8 bit unused
F24S8 24 bit float depth, 8 bit stencil
F24X8 24 bit float depth, 8 bit stencil.

Apart from bandwidth, another reason for sticking both buffers together is related to hierachical Z, seperate them and you generally lose hierachical stencil.
 
I too recently installed radlinker and I was wondering especially about which to choose from these 3 modes?

Jimmers said:
- 16,24;8 bit stencil
- 16,24,32
- 16,24,32;8 bit stencil

So could you please tell me in point by point fashion if there is any difference among them? As far as I could tell according to discussion here so far, they should all act the same, 24 bit z buffer + 8 bits for stencil but then again I'm confused.
 
Chalnoth said:
I'm pretty sure no consumer card currently supports higher than a 24-bit z-buffer. I do know that 3DLabs supports a 32-bit z-buffer, but consumer cards elect to pack the z- and stencil-buffers into one to save performance, which limits the possible precision.
Kyro has a 4 bit stencil. What might that suggest to you?

Jaws said:
Hmmm... I'm tempted to add a few comments and references to that.
 
Since the Kyro stores its depth buffer on-board, I see no reason why it has to link the two buffers at all. Regardless, I said, "currently." The Kyro is sufficiently defunct to not be considered a current consumer video card anymore.
 
Doesn't matter either way. It's not a current consumer card.

Still, got a doc that states the depth accuracy of the Kyro?
 
Mendel said:
I too recently installed radlinker and I was wondering especially about which to choose from these 3 modes?

Jimmers said:
- 16,24;8 bit stencil
- 16,24,32
- 16,24,32;8 bit stencil

So could you please tell me in point by point fashion if there is any difference among them? As far as I could tell according to discussion here so far, they should all act the same, 24 bit z buffer + 8 bits for stencil but then again I'm confused.

ChrisW is the author of RadLinker IIRC and he visits these boards sometimes. Might be worth sending him a PM (and let me know the result :)).

Can someone explain the stencil concept a bit more. Right now I see there's no purpose to selecting a 32 option, that's either future proofing, or redundant registry values. However, what's the difference between selecting 24 bit and 24bit 8bit stencil?

I also wonder, if you select a value too high for the card, what does it fall back to? Do the values above suggest that it tries 32, then 24 then 16?
 
Basically, you get to use the stencil buffer. You can increase or decrease the value in the stencil buffer, as well as perform a test against the stencil buffer (for example, throw a pixel out if the value in the stencil buffer is nonzero).

This has been used for some time for shadowing, and Humus recently produced a demo that used the stencil buffer to implement a multipass dynamic branching technique.
 
Does that mean that 24bit 8bit stencil indicates that 8bits of those 24 are being dedicated to the stencil buffer? Is that a good trade?
 
Quitch said:
Does that mean that 24bit 8bit stencil indicates that 8bits of those 24 are being dedicated to the stencil buffer? Is that a good trade?
No, it means 24+8 so that it fits into a nice round power of 2.
 
Back
Top