From 8e9d7611aef259089d832b8cf1134bef711c6918 Mon Sep 17 00:00:00 2001
From: ROllerozxa <rollerozxa@voxelmanip.se>
Date: Sat, 16 Dec 2023 19:15:34 +0100
Subject: [PATCH] Apply saturation even if tonemapping is disabled

---
 client/shaders/second_stage/opengl_fragment.glsl | 5 +++--
 doc/lua_api.md                                   | 5 ++---
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/client/shaders/second_stage/opengl_fragment.glsl b/client/shaders/second_stage/opengl_fragment.glsl
index 5ec58a087..3b0d4c844 100644
--- a/client/shaders/second_stage/opengl_fragment.glsl
+++ b/client/shaders/second_stage/opengl_fragment.glsl
@@ -78,6 +78,7 @@ vec4 applyToneMapping(vec4 color)
 	color.rgb *= whiteScale;
 	return vec4(pow(color.rgb, vec3(1.0 / gamma)), color.a);
 }
+#endif
 
 vec3 applySaturation(vec3 color, float factor)
 {
@@ -86,7 +87,6 @@ vec3 applySaturation(vec3 color, float factor)
 	float brightness = dot(color, vec3(0.2125, 0.7154, 0.0721));
 	return mix(vec3(brightness), color, factor);
 }
-#endif
 
 #ifdef ENABLE_DITHERING
 // From http://alex.vlachos.com/graphics/Alex_Vlachos_Advanced_VR_Rendering_GDC2015.pdf
@@ -144,8 +144,9 @@ void main(void)
 	{
 #if ENABLE_TONE_MAPPING
 		color = applyToneMapping(color);
-		color.rgb = applySaturation(color.rgb, saturation);
 #endif
+
+		color.rgb = applySaturation(color.rgb, saturation);
 	}
 
 #ifdef ENABLE_DITHERING
diff --git a/doc/lua_api.md b/doc/lua_api.md
index b15040f99..a85bb8152 100644
--- a/doc/lua_api.md
+++ b/doc/lua_api.md
@@ -8028,9 +8028,8 @@ child will follow movement and rotation of that bone.
     * Passing no arguments resets lighting to its default values.
     * `light_definition` is a table with the following optional fields:
       * `saturation` sets the saturation (vividness; default: `1.0`).
-          values > 1 increase the saturation
-          values in [0,1) decrease the saturation
-            * This value has no effect on clients who have the "Tone Mapping" shader disabled.
+        * values > 1 increase the saturation
+        * values in [0,1] decrease the saturation
       * `shadows` is a table that controls ambient shadows
         * `intensity` sets the intensity of the shadows from 0 (no shadows, default) to 1 (blackness)
             * This value has no effect on clients who have the "Dynamic Shadows" shader disabled.