X Tutup
Skip to content

Hide tonemap_exposure from editor when using Compatibility with BG_CANVAS.#113863

Open
allenwp wants to merge 1 commit intogodotengine:masterfrom
allenwp:compat-editor-fix-tonemap-exposure
Open

Hide tonemap_exposure from editor when using Compatibility with BG_CANVAS.#113863
allenwp wants to merge 1 commit intogodotengine:masterfrom
allenwp:compat-editor-fix-tonemap-exposure

Conversation

@allenwp
Copy link
Contributor

@allenwp allenwp commented Dec 10, 2025

Issue description

Tonemap exposure does not work with the Compatibility renderer when the Environment background mode is set to Canvas:

  1. Create a new 2D scene with the Compatibility renderer
  2. Add a WorldEnvironment with an Environment
  3. Set background mode to Canvas
  4. Optional: Enable BCS color adjustments or glow to force post.glsl to be used
  5. Adjust tonemap exposure
  6. Note that the exposure adjustment does nothing

This issue is reproducible as far back as v4.3.stable.official [77dcf97]. In earlier versions of Godot 4, it is still reproducible, but the Canvas background mode seems to not function at all.

This issue is entirely separate from the issue that is fixed by #113861 as demonstrated by the optional step 4 that forces post.glsl to be used.

This PR

This PR simply hides the non-functional tonemap exposure parameter in the specific configuration where it does not function. I have updated the docs to note this limitation.

Additionally, I have removed the old note that I had introduced as a part of #102820 that said: Values provided to the tonemapper will also be multiplied by 2.0 and 1.8 for [constant TONE_MAPPER_FILMIC] and [constant TONE_MAPPER_ACES] respectively to produce a similar apparent brightness as [constant TONE_MAPPER_LINEAR]. At the time I wrote this, I assumed it must be true, but for some scenes this is not true: The extra 2.0 and 1.8 multipliers actually make Filmic and ACES sometimes appear much brighter than Linear. So I really don't know why these extra multipliers exist and should never have added this unhelpful note in the first place.

Why not just add support for exposure to Compatibility with BG_CANVAS?

I looked into this option and discovered that it is probably not worth it. Here is the summary of my decision:

  1. Exposure must be applied to linear-encoded colour values
  2. Exposure should impact the glow effect
  3. The glow effect texture is currently generated based on nonlinear srgb-encoded values that have exposure baked in (in the case of 3D scenes)
  4. The glow effect is applied before converting to linear values in post.glsl to match the encoding that was used to create the glow texture

So currently, the behaviour is correct and as expected. If I were to add an exposure to post.glsl, it would not correctly interact with the existing glow functionality's colour encoding.

Maybe there is a way to work around this, but honestly I expect that very few people would even need this exposure feature for this specific configuration, so simply hiding it in the editor sounds to me like the correct choice. If there is a strong demand for the feature, we can try and solve this complicated problem then.

Cherry picks

I've added the cherry pick label for 4.4 and 4.5. Another label for 4.3 could be added, but I've chosen to omit this because the docs change will conflict. (It's a trivial conflict, though, so we could even cherry pick it to 4.3 if that's desired.)

@allenwp allenwp requested a review from a team as a code owner December 10, 2025 21:23
@allenwp allenwp added this to the 4.6 milestone Dec 10, 2025
@allenwp allenwp added cherrypick:4.5 Considered for cherry-picking into a future 4.5.x release cherrypick:4.4 Considered for cherry-picking into a future 4.4.x release topic:editor labels Dec 11, 2025
@allenwp allenwp force-pushed the compat-editor-fix-tonemap-exposure branch from 68b4b05 to 8e0e45d Compare January 7, 2026 20:17
@Repiteo Repiteo modified the milestones: 4.6, 4.x Jan 26, 2026
@allenwp allenwp added the cherrypick:4.6 Considered for cherry-picking into a future 4.6.x release label Jan 26, 2026
@allenwp allenwp force-pushed the compat-editor-fix-tonemap-exposure branch from 8e0e45d to 8d93f18 Compare January 26, 2026 17:08
@allenwp allenwp force-pushed the compat-editor-fix-tonemap-exposure branch from 8d93f18 to c02c568 Compare February 24, 2026 18:13
Copy link
Contributor

@blueskythlikesclouds blueskythlikesclouds left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not too sure about this, since the exposure still gets applied to 3D objects, it's just the canvas background that doesn't handle it.

Edit:

I've been looking into a solution and came up with this: https://github.com/blueskythlikesclouds/godot/tree/compatibility-canvas-background-exposure-fix

When exposure is enabled, we can force the intermediary buffer, and copy it with the exposure as the multiplier (alongside the luminance multiplier).

Converting the exposure to sRGB is an approximation. It might be more accurate to do this in the copy shader instead:

color = srgb_to_linear(color)
color *= exposure
color = linear_to_srgb(color)
color *= luminance_multiplier

This forces the intermediary buffer to exist even with glow off, but it might be better than the feature just not working at all.

@allenwp
Copy link
Contributor Author

allenwp commented Mar 5, 2026

Thanks! Of course, making exposure work is definitely a better solution than simply noting that exposure is not available for canvas background mode.

I think I’ll need to look deeper into your proposed solution sometime later because there’s a lot of nuance regarding how exposure interacts with the glow effect and the encoding (linear or nonlinear sRGB) that is used during the calculations of the glow effect.

Specifically:

  1. The glow effect texture is currently generated based on nonlinear srgb-encoded values that have exposure baked in (in the case of 3D scenes)
  2. The glow effect is applied before converting to linear values in post.glsl to match the encoding that was used to create the glow texture

To be honest, it will take me a few hours to get my head back into this, so I can’t remember the exact details, besides what I wrote in the PR’s description text. Feel free to open another PR in the meantime for me to review if you’d like, but otherwise I’ll simply look into what you’ve already provided sometime the future.

Also, even if we fix this properly in the future, there may still be an option for using this PR as a cherry pick for the old versions.

If we run out of time for a proper fix for 4.7, this PR may still be valuable to merge to master because it turns an obvious user-facing bug into a known limitation.

Thanks again!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug cherrypick:4.4 Considered for cherry-picking into a future 4.4.x release cherrypick:4.5 Considered for cherry-picking into a future 4.5.x release cherrypick:4.6 Considered for cherry-picking into a future 4.6.x release topic:editor topic:rendering

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Compatibility: Canvas tonemap does not always work and exposure never works

3 participants

X Tutup