-
How do you enable a w-buffer?
Do you have to use an extension of some sort? In Direct3D it's really simple: m_Device->SetRenderState( D3DRS_ZENABLE, D3DZB_USEW ). I'm sure it's more complicated with OpenGL, but how do you do it? The Red Book does not even allude to the existence of w-buffers.
-
Advanced Member
Frequent Contributor
Re: How do you enable a w-buffer?
AFAIK OpenGL really only deals with a "depth buffer". It does not specifically say that it's Z or W (only that "very far away" = 1.0, and "very close" = 0.0). I have found no way to controlling the depth buffer format under OpenGL. Perhaps some drivers allow changing this on a global basis (in display settings under Windows, for instance).
-
Re: How do you enable a w-buffer?
Well, there's no option for me (with a GeForce2 Go) to select whether OpenGL uses a z-buffer or w-buffer. But I'm sure OpenGL must support this somehow, right?
-
Senior Member
OpenGL Pro
Re: How do you enable a w-buffer?
There is probably an OpenGL extension for w-buffer support, but none that I'm aware of.
You could implement your own with the depth replace texture shaders on GeForce3 and GeForce4 Ti.
Thanks -
Cass
-
Re: How do you enable a w-buffer?
I have a GeForce2 which doesn't support pixel shaders, but anyway I'd want to support w-buffers on any card that allows it, not just cards that have pixel shading.
-
Senior Member
OpenGL Guru
Re: How do you enable a w-buffer?
>>I have a GeForce2 which doesn't support pixel shaders, but anyway I'd want to support w-buffers on any card that allows it, not just cards that have pixel shading.<<
i dont believe all cards support it (even with d3d) so it looks like youre stuff with the zbuffer
which imho is a lot better than a wbuffer.
if u want more precision at far ranges of the zbuffer theres a few things u can do.
search this group for examples
-
Re: How do you enable a w-buffer?
I wasn't planning on requiring w-buffers, but I should allow it for all cards that support w-buffers without necessarily supporting pixel shading, was my point.
Anyway I read a tutorial online and discovered that w-buffer are inaccurate at close range, which is definitely Not Good. So I'll just stick with a z-buffer, I guess, and see how good/bad the w-buffer is in D3D.
-
Advanced Member
Frequent Contributor
Re: How do you enable a w-buffer?
It is my understanding that the precision of the W buffer is equal regardless of distance, while the precision of the Z buffer is better at close distances and worse at far distances. In general, you want the Z buffer behaviour (closer is more important).
Cass, when I was writing a Glide -> OpenGL wrapper, I was searching high and low for an OpenGL extension that allowed selection of depth buffer format (in Glide you can select W or Z), but I didn't find any.
[This message has been edited by marcus256 (edited 04-16-2002).]
-
Re: How do you enable a w-buffer?
You're right, Marcus; that's what I meant. The W-buffer is more inaccurate at close distances than the z-buffer. The inaccuracy is even throughout, since it's just the floating-point precision that limits it, but close-up it might be very noticeable. For the terrain it won't be noticeable, but for other objects it probably will.
-
Senior Member
OpenGL Pro
Re: How do you enable a w-buffer?
CGameProgrammer,
Careful. W varies linearly in eye space, so if you stored it in fixed point, the accuracy is independent of the depths being resolved. If you store W in floating point, you *do* change the way precision is distributed. Floating point naturally packs more precision toward zero. That's why some people advocate having a floating point z buffer with a glDepthRange(1,0). The idea would be to try to balance the uneven distribution of the z buffer with the uneven precision distribution of floating point.
Thanks -
Cass
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules