question about light prepass and msaa

Hey all, I am working on a light pre-pass renderer in gl 2.x currently and have some issues with MSAA.

Near as I can figure it, I only really have a couple of choices.

  1. only msaa the forward pass, which means I don’t gain early Z rejection from my pre-pass, as they have to use different depth buffers.

  2. do 3 passes
    pass 1 - burn depth only to msaa buffer

    • resolve depth to prepass FBO
      pass 2 - g buffer pre pass
      pass 3 - forward pass using pass 1 depth buffer.

Any other ways I could go here?

thanks for any input.

To the best of my knowledge, the only way to get “proper” MSAA with a light prepass renderer is to render and average the lighting using per-sample data. So you would need access to the samples for your normal and depth buffers.

Insomniac games vaguely covers their implementation in the article on their “prelighting” system:

Also, see Engel’s and the next talk here: