summaryrefslogtreecommitdiff
path: root/client
diff options
context:
space:
mode:
authorLars Hofhansl <larsh@apache.org>2016-10-24 08:23:13 -0700
committerNer'zhul <nerzhul@users.noreply.github.com>2016-10-25 07:49:19 +0200
commit98176481c1d0b6f8960574af1c2568085e37e433 (patch)
treed5a935d3591c3fb40db7342e66df139a65196b6d /client
parent779d2c5f64e321cc126b3e3abed9e37fd30edb1b (diff)
downloadminetest-98176481c1d0b6f8960574af1c2568085e37e433.tar.gz
minetest-98176481c1d0b6f8960574af1c2568085e37e433.tar.bz2
minetest-98176481c1d0b6f8960574af1c2568085e37e433.zip
Shaders: Apply tone mapping before fog calculation.
Diffstat (limited to 'client')
-rw-r--r--client/shaders/nodes_shader/opengl_fragment.glsl8
-rw-r--r--client/shaders/water_surface_shader/opengl_fragment.glsl8
2 files changed, 8 insertions, 8 deletions
diff --git a/client/shaders/nodes_shader/opengl_fragment.glsl b/client/shaders/nodes_shader/opengl_fragment.glsl
index 299de2749..09c40b652 100644
--- a/client/shaders/nodes_shader/opengl_fragment.glsl
+++ b/client/shaders/nodes_shader/opengl_fragment.glsl
@@ -194,6 +194,10 @@ void main(void)
vec4 col = vec4(color.rgb * gl_Color.rgb, 1.0);
+#ifdef ENABLE_TONE_MAPPING
+ col = applyToneMapping(col);
+#endif
+
#if MATERIAL_TYPE == TILE_MATERIAL_LIQUID_TRANSPARENT
float alpha = gl_Color.a;
if (fogDistance != 0.0) {
@@ -209,9 +213,5 @@ void main(void)
col = vec4(col.rgb, base.a);
#endif
-#ifdef ENABLE_TONE_MAPPING
- gl_FragColor = applyToneMapping(col);
-#else
gl_FragColor = col;
-#endif
}
diff --git a/client/shaders/water_surface_shader/opengl_fragment.glsl b/client/shaders/water_surface_shader/opengl_fragment.glsl
index 8321ddf93..d910220e9 100644
--- a/client/shaders/water_surface_shader/opengl_fragment.glsl
+++ b/client/shaders/water_surface_shader/opengl_fragment.glsl
@@ -150,6 +150,10 @@ vec4 base = texture2D(baseTexture, uv).rgba;
vec4 col = vec4(color.rgb * gl_Color.rgb, 1.0);
+#ifdef ENABLE_TONE_MAPPING
+ col = applyToneMapping(col);
+#endif
+
#if MATERIAL_TYPE == TILE_MATERIAL_LIQUID_TRANSPARENT || MATERIAL_TYPE == TILE_MATERIAL_LIQUID_OPAQUE
float alpha = gl_Color.a;
if (fogDistance != 0.0) {
@@ -165,9 +169,5 @@ vec4 base = texture2D(baseTexture, uv).rgba;
col = vec4(col.rgb, base.a);
#endif
-#ifdef ENABLE_TONE_MAPPING
- gl_FragColor = applyToneMapping(col);
-#else
gl_FragColor = col;
-#endif
}