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 3 of 3

Thread: FBO, Depth texture and Frustum

  1. #1
    Junior Member Newbie
    Join Date
    Mar 2004
    Location
    parksville, BC, Canada
    Posts
    6

    FBO, Depth texture and Frustum

    Hi, I have a deferred rendering solution that uses an FBO RTT to render the scene data into.

    One of the attached textures is the depth buffer, which SEEMED to work until I noticed that if I change the characteristics of the camera's frustum, the actual values of the depth texture don't change. I have verified this by moving the far clip plane, and reviewing the resulting depth texture. It doesn't change.

    What is weird, that the far clip plane does clip the geometry that is being still rendered to the depth texture.

    What am I missing?

  2. #2
    Senior Member OpenGL Guru Dark Photon's Avatar
    Join Date
    Oct 2004
    Location
    Druidia
    Posts
    3,224
    Quote Originally Posted by krazanmp View Post
    ...if I change the characteristics of the camera's frustum, the actual values of the depth texture don't change. I have verified this by moving the far clip plane, and reviewing the resulting depth texture. It doesn't change....What am I missing?
    Are you sure about that?

    Assuming you have a std 32-bit depth+stencil buffer, try reading it back as:

    Code cpp:
        glReadPixels( 0, 0, xres, yres, GL_DEPTH_STENCIL, GL_UNSIGNED_INT_24_8, buf );

    and look at the actual fixed-point values ( pix >> 8).


    Rendering a plane right in front of the near clip plane and look at its fixed-point depth value.

    Then halve the distance to the near clip plane, render the plane at the same eye-space Z value as before, and then look at its fixed-point depth value.

    If still problems, post some specific number (i.e. near/far values with the eye-space Z input values and the fixed-point Z readback values).
    Last edited by Dark Photon; 06-23-2014 at 06:24 AM.

  3. #3
    Junior Member Newbie
    Join Date
    Mar 2004
    Location
    parksville, BC, Canada
    Posts
    6
    I am actually rendering the image overlaid on the rendered scene and animating the far component of the frustum using cos(accum) * 5000.0f + 5100.0f, which oscilates the far clip plane via a sin wave between 100.0 to 10100.0 units. This is visually verified by the obvious clipping of the rendered image. However as this is occurring, the rendered depth buffer doesn't change at all (unless I move the viewpoint).

    I would expect that with such a dramatic change in the far clip distance that the rendered image would also have a dramatic change in appearance.

    I will try reading the pixels back to the CPU first thing tomorrow morning.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •