New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Tonemapping effect does not do much anymore #14088
Comments
I’d consider that a bug. Minetest doesn’t use any HDR rendering so that so-called “tone mapping” is just a fancy visual effect, and it should do whatever it did, i.e. make dull MTG textures shine.
Totally unlikely. The intention was likely to apply filters in the linear colorspace as that’s where they’re typically defined (not that that makes much sense with Minetest’s lighting model). Tone mapping however, was apparently dependent on working in the non-linear sRGB(-like) colorspace (regardless of what colorspace the original UC2 function was designed for). |
I agree with @numberZero . That's a bug we should fix. @rollerozxa Feel like creating a PR? |
Will do. I've basically got the fix ready already. While I was at it I was looking at why the saturation effect requires tonemapping to be enabled and realised there is absolutely no reason it requires tonemapping to be enabled to work (it was just put behind a preprocessor block like that for some reason) |
A saturation-increasing effect usually requires tonemapping, or at least a proper gamut clipping, so that out-of-gamut colours are mapped well to colours which can be displayed: However, for this the tonemapping should support input colour values less than 0 and it should be applied after the saturation increase and not before, like it's done in Minetest. I think tonemapping should not be applied in the sRGB colour space, so personally I prefer an adjustment of the tonemapping parameters instead, which could have a similar effect to switching colour spaces. |
That doesn’t matter IMO. It’s just a visual effect. |
I was looking through some of my old screenshots, and noticed how much brighter and vibrant they are with tonemapping compared to looking at Minetest with tonemapping enabled right now. For example, take this screenshot from 2020 of my old city world with tonemapping enabled:
I still have the world, so I booted it up on Minetest 5.8.0 with tonemapping enabled and tried to get into the same position as the old screenshot:
It looks dull! Compared to the old tonemapping, it feels like there's a darkening filter applied over the image, there is not as much contrast if you look at e.g. the stone brick texture. There's not much difference when tonemapping is enabled compared to when it is disabled now.
Looking at a git blame for the tonemapping code, it led me to the commit which added bloom shaders. It both changed the
applyToneMapping
function and enclosed it in some bloom related code, having the tonemapping effect be affected by the "translate to linear colorspace" (unsure what this means) line. I made these quick and dirty changes to thesecond_stage
shader in an attempt to revert to the previous effect, reverting the changes inapplyToneMapping
and putting the call above "translate to linear colorspace":The resulting image looks almost identical to the old tonemapping that you could see in the first image. Vibrant and bright:
So what?
I am unsure if this change that was made as a part of the bloom commit is a bug or if it was intentional to nerf the effect caused by tonemapping, and since x2048 is no longer around it would be hard to know for sure. Personally I consider the change to be a bug and should be fixed by making the effect look like it used to (basically by doing what my diff above does, but keeping the saturation effect intact), but I'm sure someone who thought the old tonemapping was too bright would consider it to be an intentional change.
The text was updated successfully, but these errors were encountered: