Derpius/VisTrace

[feature] Upgrade tone mapping function

Closed this issue · 1 comments

Is your feature request related to a problem? Please describe.
The existing tone mapping implementation has two issues:

  • Looking at other post processing stacks it appears that simply gamma correcting the linear output with 2.2 is not correct, so making the user convert linear to sRGB isn't viable
  • Without the user implementing a full exposure system themselves (or using an extension), the tone mapping function is effectively useless for good quality renders

Describe the solution you'd like
When researching post processing stacks for VisCam I decided to validate the implementation of converting the linear HDR rendered image to LDR, revisiting the repository I got the ACES tone mapping fit from: https://github.com/TheRealMJP/BakingLab/blob/master/BakingLab/ToneMapping.hlsl#L105

As you can see the ACES fit output is converted to sRGB using the full function which the tone mapper should also do

As for exposure, the function should have a boolean input, defaulting to true, that toggles full image luminance auto exposure. This means anyone can get good renders without needing to implement their own exposure function

Additional context
True sRGB vs gamma 2.2: https://www.shadertoy.com/view/7sjBWD

Should probably default auto exposure to false to avoid breaking existing renderers