From 4af8009b9d1e89a7811b427bdfa73503541227b7 Mon Sep 17 00:00:00 2001 From: Juan Linietsky Date: Tue, 12 Feb 2019 14:33:57 -0300 Subject: [PATCH] Fix fog in GLES2 by using epic hack, closes #25410 --- drivers/gles2/shaders/scene.glsl | 10 ++++++++++ drivers/gles3/rasterizer_canvas_gles3.cpp | 2 ++ 2 files changed, 12 insertions(+) diff --git a/drivers/gles2/shaders/scene.glsl b/drivers/gles2/shaders/scene.glsl index 6c3d3baccdd..242329d4a72 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 diff --git a/drivers/gles3/rasterizer_canvas_gles3.cpp b/drivers/gles3/rasterizer_canvas_gles3.cpp index b8f0965af82..29b4b0c6c46 100644 --- a/drivers/gles3/rasterizer_canvas_gles3.cpp +++ b/drivers/gles3/rasterizer_canvas_gles3.cpp @@ -1704,6 +1704,8 @@ void RasterizerCanvasGLES3::canvas_debug_viewport_shadows(Light *p_lights_with_s light = light->shadows_next_ptr; } + + canvas_end(); } void RasterizerCanvasGLES3::canvas_light_shadow_buffer_update(RID p_buffer, const Transform2D &p_light_xform, int p_light_mask, float p_near, float p_far, LightOccluderInstance *p_occluders, CameraMatrix *p_xform_cache) {