-
Junior Member
Regular Contributor
more z-Buffer control
something like writing a specified value to z-buffer if test passes, instead of depthvalue ...
-
Senior Member
OpenGL Guru
Re: more z-Buffer control
Can't this be done with the help of the stencil buffer?
-
Junior Member
Regular Contributor
Re: more z-Buffer control
The short answer: No.
I wanted this feature for doing a trick for shadowing actually.
V-man
-
Re: more z-Buffer control
Actually it can be done with the help of a stencil buffer in two passes, as long as the depthvalue is a constant.
First pass:
Clear stencil buffer
Depth testing enabled
Set stencil to write 1 for all pixels that pass depth testing
Draw object
Second pass:
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
Draw object
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.
-
Junior Member
Regular Contributor
Re: more z-Buffer control
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...
V-man
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