HDR, adaptive tone mapping and MSAA in GLSL

后端 未结 2 1076
迷失自我
迷失自我 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:34

    I don't have a copy of the Superbible, so I don't know their exact proposition, but this approach seems very inefficient, and imprecise : your 5x5 filter is only accessing the 'i'th sample of each texel, and totally misses the other samples.

    For the filtering phase, I'd go, as kvark already suggested, for a resolve in another texture using glBlitFramebuffer to have all samples accumulated in HDR. After that, doing the filter in another HDR texture, probably using a separable filter to gain performance, or even using GPU hardware to help increasing further the performance, using bilinear filtering.

    This would given you a blurred texture that you could then sample in your tone mapping shader. This should vastly improve performance, but use more memory.

    Note that other tone mapping operators exist, and that there is no 'ground truth' in this domain. You could choose to use more a performant approach by not using a such fine grained luminosity estimate.

    You could look at Matt Pettineo's recent blog post about tone mapping, this could give you hints about how to improve things, perhaps by using glGenerateMipMaps to create the luminosity texture.

    Regarding the specific issues about tone mapping with MSAA, the only thing I'm aware of is that it's recommended to tone map individual samples before the MSAA resolve, to prevent aliasing artifacts from appearing.

提交回复
热议问题