Reverts the default value of Environment.glow_hdr_threshold from 0.0
back to 1.0 to restore the expected glow appearance in existing projects.
The default was inadvertently changed from 1.0 to 0.0 in PR #110077,
which caused glow effects to render dramatically different across all
rendering methods (Forward+, Mobile, and GL Compatibility). This broke
backward compatibility with existing projects like the Kenney 3D
Platformer starter kit.
Changed files:
- scene/resources/environment.h
- servers/rendering/storage/environment_storage.h
- drivers/gles3/effects/glow.h
- drivers/gles3/rasterizer_scene_gles3.cpp
- doc/classes/Environment.xml
Setting the value back to 1.0 aligns with documented recommendations
and restores visual consistency.
Fixes#112469
Mobile devices are typically bandwidth bound which means we need to do as few texture samples as possible.
They typically use TBDR GPUs which means that all rendering takes place on special optimized tiles. As a side effect, reading back memory from tile to VRAM is really slow, especially on Mali devices.
This commit uses a technique where you do a small blur while downsampling, and then another small blur while upsampling to get really high quality glow. While this doesn't reduce the renderpass count very much, it does reduce the texture read bandwidth by almost 10 times. Overall glow was more texture-read bound than memory write, bound, so this was a huge win.
A side effect of this new technique is that we can gather the glow as we upsample instead of gathering the glow in the final tonemap pass. Doing so allows us to significantly reduce the cost of the tonemap pass as well.
Additionally, change the minimum `tonemap_white` parameter to `1.0`; users can increase `tonemap_exposure` for a similar effect to decreasing `tonemap_white` below `1.0`.
Co-authored-by: Hei <40064911+Lielay9@users.noreply.github.com>
Co-authored-by: Hugo Locurcio <hugo.locurcio@hugo.pro>
Fixes#99592
The following variables were set too early, and later code never ran..
prev_shader, prev_variant, prev_spec_constants variables
These variables were shared in two different branch conditions but were
updated inside the first one, so the second could never be true..
The condition to update lighting also should check prev_spec_constants
since it updates that uniform.