summaryrefslogtreecommitdiff
path: root/drivers/gles2/shaders
diff options
context:
space:
mode:
authorJuan Linietsky <reduzio@gmail.com>2019-02-12 14:33:57 -0300
committerJuan Linietsky <reduzio@gmail.com>2019-02-12 14:35:16 -0300
commit4af8009b9d1e89a7811b427bdfa73503541227b7 (patch)
tree1ca6b037b4ad6c54049db47f039afb88c218f172 /drivers/gles2/shaders
parent8b77dac56e375698cdd28bc6033d076c600a5a19 (diff)
Fix fog in GLES2 by using epic hack, closes #25410
Diffstat (limited to 'drivers/gles2/shaders')
-rw-r--r--drivers/gles2/shaders/scene.glsl10
1 files changed, 10 insertions, 0 deletions
diff --git a/drivers/gles2/shaders/scene.glsl b/drivers/gles2/shaders/scene.glsl
index 6c3d3baccd..242329d4a7 100644
--- a/drivers/gles2/shaders/scene.glsl
+++ b/drivers/gles2/shaders/scene.glsl
@@ -2049,7 +2049,13 @@ FRAGMENT_SHADER_CODE
#if defined(USE_VERTEX_LIGHTING)
+#if defined(BASE_PASS)
gl_FragColor.rgb = mix(gl_FragColor.rgb, fog_interp.rgb, fog_interp.a);
+#else
+ gl_FragColor.rgb *= (1.0 - fog_interp.a);
+#endif // BASE_PASS
+
+
#else //pixel based fog
float fog_amount = 0.0;
@@ -2083,7 +2089,11 @@ FRAGMENT_SHADER_CODE
}
#endif
+#if defined(BASE_PASS)
gl_FragColor.rgb = mix(gl_FragColor.rgb, fog_color, fog_amount);
+#else
+ gl_FragColor.rgb *= (1.0 - fog_amount);
+#endif // BASE_PASS
#endif //use vertex lit