Skip to content

Commit 9817648

Browse files
lhofhanslnerzhul
authored andcommittedOct 25, 2016
Shaders: Apply tone mapping before fog calculation.
1 parent 779d2c5 commit 9817648

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed
 

Diff for: ‎client/shaders/nodes_shader/opengl_fragment.glsl

+4-4
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,10 @@ void main(void)
194194

195195
vec4 col = vec4(color.rgb * gl_Color.rgb, 1.0);
196196

197+
#ifdef ENABLE_TONE_MAPPING
198+
col = applyToneMapping(col);
199+
#endif
200+
197201
#if MATERIAL_TYPE == TILE_MATERIAL_LIQUID_TRANSPARENT
198202
float alpha = gl_Color.a;
199203
if (fogDistance != 0.0) {
@@ -209,9 +213,5 @@ void main(void)
209213
col = vec4(col.rgb, base.a);
210214
#endif
211215

212-
#ifdef ENABLE_TONE_MAPPING
213-
gl_FragColor = applyToneMapping(col);
214-
#else
215216
gl_FragColor = col;
216-
#endif
217217
}

Diff for: ‎client/shaders/water_surface_shader/opengl_fragment.glsl

+4-4
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,10 @@ vec4 base = texture2D(baseTexture, uv).rgba;
150150

151151
vec4 col = vec4(color.rgb * gl_Color.rgb, 1.0);
152152

153+
#ifdef ENABLE_TONE_MAPPING
154+
col = applyToneMapping(col);
155+
#endif
156+
153157
#if MATERIAL_TYPE == TILE_MATERIAL_LIQUID_TRANSPARENT || MATERIAL_TYPE == TILE_MATERIAL_LIQUID_OPAQUE
154158
float alpha = gl_Color.a;
155159
if (fogDistance != 0.0) {
@@ -165,9 +169,5 @@ vec4 base = texture2D(baseTexture, uv).rgba;
165169
col = vec4(col.rgb, base.a);
166170
#endif
167171

168-
#ifdef ENABLE_TONE_MAPPING
169-
gl_FragColor = applyToneMapping(col);
170-
#else
171172
gl_FragColor = col;
172-
#endif
173173
}

0 commit comments

Comments
 (0)
Please sign in to comment.