1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-04 12:00:25 +00:00

Merge pull request #111897 from allenwp/environment-adj-prioritize-old-behaviour

Improve `Environment` adjustments (favor old behavior and quality).
This commit is contained in:
Thaddeus Crews
2025-10-23 11:03:56 -05:00
5 changed files with 69 additions and 45 deletions

View File

@@ -793,7 +793,9 @@ void RendererEnvironmentStorage::environment_set_adjustment(RID p_env, bool p_en
ERR_FAIL_NULL(env);
env->adjustments_enabled = p_enable;
env->adjustments_brightness = p_brightness;
// Scale brightness via the nonlinear sRGB transfer function to provide a
// somewhat perceptually uniform brightness adjustment.
env->adjustments_brightness = p_brightness < 0.04045f ? p_brightness * (1.0f / 12.92f) : Math::pow(float((p_brightness + 0.055f) * (1.0f / (1.055f))), 2.4f);
env->adjustments_contrast = p_contrast;
env->adjustments_saturation = p_saturation;
env->use_1d_color_correction = p_use_1d_color_correction;