Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 5 of 5

Thread: more z-Buffer control

  1. #1
    Junior Member Regular Contributor
    Join Date
    May 2001
    Location
    Germany, Hannover
    Posts
    160

    more z-Buffer control

    something like writing a specified value to z-buffer if test passes, instead of depthvalue ...

  2. #2
    Senior Member OpenGL Guru
    Join Date
    Feb 2000
    Location
    Sweden
    Posts
    2,982

    Re: more z-Buffer control

    Can't this be done with the help of the stencil buffer?

  3. #3
    Junior Member Regular Contributor
    Join Date
    Dec 2000
    Location
    montreal
    Posts
    105

    Re: more z-Buffer control

    The short answer: No.

    I wanted this feature for doing a trick for shadowing actually.

    V-man
    V--man

  4. #4
    Senior Member OpenGL Pro
    Join Date
    Jun 2000
    Location
    Shreveport, LA, USA
    Posts
    1,505

    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.

  5. #5
    Junior Member Regular Contributor
    Join Date
    Dec 2000
    Location
    montreal
    Posts
    105

    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
    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
  •