View Full Version : more z-Buffer control
something like writing a specified value to z-buffer if test passes, instead of depthvalue ...
Can't this be done with the help of the stencil buffer?
08-03-2001, 01:17 PM
The short answer: No.
I wanted this feature for doing a trick for shadowing actually.
08-05-2001, 12:39 PM
Actually it can be done with the help of a stencil buffer in two passes, as long as the depthvalue is a constant.
Clear stencil buffer
Depth testing enabled
Set stencil to write 1 for all pixels that pass depth testing
Mask color buffer
Set depth range (near and far) to value to write
Set depth function to GL_ALWAYS
Enable stencil testing, set test to pass on stencil values of 1, otherwise fail
The result is that for pixels that have a stencil value of 1 from the first pass, in the second pass will be assigned the desired zdepth.
08-05-2001, 05:09 PM
The problem is the object to render. It must be billboarded and be at the proper depth. Maybe a few other things like depth range need to be changed too but that's not an issue.
Just a small problem...
Powered by vBulletin® Version 4.2.2 Copyright © 2014 vBulletin Solutions, Inc. All rights reserved.