HDR, adaptive tone mapping and MSAA in GLSL

后端 未结 2 1059
迷失自我
迷失自我 2021-02-06 10:03

In an effort to teach myself OpenGL, I am working my way trough the 5th edition of the Superbible.

I am currently trying to figure out how to combine HDR and MSAA (as de

2条回答
  •  时光说笑
    2021-02-06 10:57

    As far as I see from your GLSL code the weight for all samples of a pixel are equal. From that I conclude that the code is interested in the sum of those samples for each pixel. The sum is an average multiplied by the number of samples. From here at least two optimization techniques reveal. Both are using an intermediate single-sampled texture, from which your code is supposed to sample instead of the original multi-sampled one:

    1. (doing it precise to what you are doing). Produce an intermediate texture with a shader that writes average of the samples for each pixel.

    2. (approximating quickly). Let the intermediate texture to be just the resolved original one. Can be done effectively by calling glBlitFramebuffer(). This will produce slightly different result (because the sample locations are not on a grid), but for you task - HDR - it shouldn't matter, as it's all pretty much an approximation :)

    Good luck!

提交回复
热议问题