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

Thread: MRT and FBOs

  1. #1
    Senior Member OpenGL Guru Dark Photon's Avatar
    Join Date
    Oct 2004
    Location
    Druidia
    Posts
    4,087

    MRT and FBOs

    NVidia white-paper on Soft Particles

    See Figure 7 on pg. 11 (acroread pg 13). Pass #1 renders the opaque geometry, Pass #2 uses the depth texture generated in pass #1 to fade the particles out near opaque geometry. With this processing path, no geometry batches have to pass down the rendering pipe twice.

    Question is, is there a way in OpenGL that (in pass #1) the "Color buffer" and "Depth buffer" can be in the window-system FBO, while the "Fp32 (depth) texture" can be in a user-defined FBO?

    The goal being to render the opaque objects into the scene (color/depth) and generate the depth texture from them all-in-one go, ...without having to submit some batches multiple times.

    Is this even possible in OpenGL?


  2. #2
    Super Moderator OpenGL Lord
    Join Date
    Dec 2003
    Location
    Grenoble - France
    Posts
    5,575

    Re: MRT and FBOs

    Really not sure about this, I would like better answers myself...
    Use glDrawBuffers(), and write gl_FragDepth to gl_FragData[n] ?
    Or glCopyTexSubImage the depth buffer to a depth texture ?

  3. #3
    Advanced Member Frequent Contributor
    Join Date
    Apr 2004
    Posts
    990

    Re: MRT and FBOs

    Well, I didn't read the entire paper, but if I remember correctly, in MRT the drawbuffer parameter list should come from either the window-system provided buffers (GL_FRONT,GL_BACK,...) or the FBO buffers (GL_COLOR_ATTACHMENT0,...) but not a mix of the two. And since you can't use the window-system provided buffers as textures for the second pass (unless you copy the contents of course) you're stuck with FBO. It's easy enough to draw the FBO-texture as a fullscreen quad in the window-system provided buffers if you don't want to submit the batches again.

    N.

  4. #4
    Senior Member OpenGL Guru Dark Photon's Avatar
    Join Date
    Oct 2004
    Location
    Druidia
    Posts
    4,087

    Re: MRT and FBOs

    Quote Originally Posted by -NiCo-
    if I remember correctly, in MRT the drawbuffer parameter list should come from either the window-system provided buffers (GL_FRONT,GL_BACK,...) or the FBO buffers (GL_COLOR_ATTACHMENT0,...) but not a mix of the two.
    Thanks, that's what I thought, but wanted to make sure I wasn't missing something obvious.

    It's easy enough to draw the FBO-texture as a fullscreen quad in the window-system provided buffers if you don't want to submit the batches again.
    May end up doing just that. The snag with it is our app must have MSAA. From the spec, I gather that "All of the framebuffer-attachable images attached to a framebuffer object must have the same number of SAMPLES", which means you can't write the depth texture you need for the particles directly, even if you're using an FBO -- you have to do a full depth buffer downsample to get the single-sample depth texture, in addition to a full color buffer downsample to blit it to the system FBO at the end. Doable, but seems like a big waste of GPU resources for something so simple.

    Need to do some timings, but I'm beginning to think a single-sample depth-only pass to generate the depth texture up-front (via FBO) is gonna be cheaper than all this full-screen depth and color downsampling and blitting to get around the binding limitations...


  5. #5
    Advanced Member Frequent Contributor
    Join Date
    Apr 2004
    Posts
    990

    Re: MRT and FBOs

    Quote Originally Posted by Dark Photon
    you have to do a full depth buffer downsample to get the single-sample depth texture, in addition to a full color buffer downsample to blit it to the system FBO at the end. Doable, but seems like a big waste of GPU resources for something so simple.
    Doesn't EXT_framebuffer_blit handle this for you?

    The resolve operation is affected
    by calling BlitFramebufferEXT (provided by the EXT_framebuffer_blit
    extension) where the source is a multisample application-created
    framebuffer object and the destination is a single-sample
    framebuffer object (either application-created or window-system
    provided).
    Or are you worried about the performance impact?

    N.

  6. #6
    Senior Member OpenGL Guru Dark Photon's Avatar
    Join Date
    Oct 2004
    Location
    Druidia
    Posts
    4,087

    Re: MRT and FBOs

    Quote Originally Posted by -NiCo-
    Doesn't EXT_framebuffer_blit handle this for you?
    Yes.
    Or are you worried about the performance impact?
    Yes, exactly.

Posting Permissions

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