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: MSAA in deferred shading questions

  1. #1
    Intern Newbie
    Join Date
    Jan 2014
    Posts
    33

    MSAA in deferred shading questions

    I'm trying to tackle MSAA in deferred shading.

    Here' my current deferred renderering pipeline:

    Code :
    1. Geometry stage - Render geometry to textures (position/normals/diffuse)
    2. Shading stage - all output is rendered & blended into a "final texture"
        2.1 Render ambient light
        2.2 Render directional lights and shadows
        2.3 Render point lights and shadows
    3. BlitFramebuffer() on the final texture
    4. Swapbuffers and repeat 1.

    In 2.1, 2.2 and 2.3 I need to read gbuffer textures (position/normals/diffuse) to do the lighting and shadowing.

    My question is now, how do I most effectively accomplish MSAA (or any other form of good AA)? Do I have to read a number of samples in all the 3 shading passes (2.1, 2.2 and 2.3: sounds expensive!) or what?

  2. #2
    Senior Member OpenGL Guru Dark Photon's Avatar
    Join Date
    Oct 2004
    Location
    Druidia
    Posts
    3,213
    Quote Originally Posted by TheKaiser View Post
    My question is now, how do I most effectively accomplish MSAA (or any other form of good AA)? Do I have to read a number of samples in all the 3 shading passes (2.1, 2.2 and 2.3: sounds expensive!) or what?
    Yes. Though it's not as expensive as you'd think it'd be. Years ago, Killzone did this IIRC, running shaders per-pixel, reading all the subsamples (2X I think), and writing out to a 1X lighting buffer. I've done it with 4X -> 1X and was really shocked at how fast it is on a high-end GPU. This is easy to try, so I would just do it and see what you find on your hardware.

    Then there's the whole issue of how to maximize efficiency with MSAA deferred. I'd highly recommend Lauritzen's 2010 SIGGRAPH talk on Deferred Shading (Deferred Rendering for Current and Future Rendering Pipelines). Get rid of all the state changes between light sources, look toward tile-based deferred, and then pushing the entire lighting pass (light source culling, binning, and rendering) onto the GPU.

  3. #3
    Intern Newbie
    Join Date
    Jan 2014
    Posts
    33
    I'm kinda torn between going either MSAA or FXAA (or both combined? at the same time? if that works) approach to my deferred shading. Any recommendations?

    For FXAA I know theres a shader lying around one can plug-and-play almost once all lighting is done.

    For MSAA, are you supposed to make the gbuffer render targets MSAA x2/x4 and then in the lighting shaders texelFetch() based on the number of samples?

    Is one superior to the other?

    EDIT: I'd like to add I'm going for OpenGL 4.2 atleast
    Last edited by TheKaiser; 06-16-2014 at 07:24 AM.

  4. #4
    Senior Member OpenGL Guru Dark Photon's Avatar
    Join Date
    Oct 2004
    Location
    Druidia
    Posts
    3,213
    Quote Originally Posted by TheKaiser View Post
    For FXAA I know theres a shader lying around one can plug-and-play almost once all lighting is done.

    For MSAA, are you supposed to make the gbuffer render targets MSAA x2/x4 and then in the lighting shaders texelFetch() based on the number of samples?

    Is one superior to the other?
    Superior how? As with all things, it depends on your requirements. Is edge AA quality or GPU mem consumption/bandwidth more important to you for instance?

  5. #5
    Intern Contributor
    Join Date
    May 2013
    Posts
    67
    Seeing it in game like Crysis3, I actually like 2xMSAA with SMAA. Its called SMAA T2.
    I also like the temporal AA that tesseract uses. (its free oss, so just test it)

Posting Permissions

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