Shaders: Apply tone mapping before fog calculation.
authorLars Hofhansl <larsh@apache.org>
Mon, 24 Oct 2016 15:23:13 +0000 (08:23 -0700)
committerNer'zhul <nerzhul@users.noreply.github.com>
Tue, 25 Oct 2016 05:49:19 +0000 (07:49 +0200)
client/shaders/nodes_shader/opengl_fragment.glsl
client/shaders/water_surface_shader/opengl_fragment.glsl

index 299de2749b9de454cf49aff701bb20fe82907577..09c40b652c194f3142e8415bb55a812fc3bb7f4f 100644 (file)
@@ -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
 }
index 8321ddf93766782d6d022ce2ae32a7412bd3c121..d910220e958ba01d02c529d0c1b72f6708fad003 100644 (file)
@@ -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
 }