summaryrefslogtreecommitdiff
path: root/servers/rendering/rasterizer_rd/shaders/sky.glsl
diff options
context:
space:
mode:
authorHugo Locurcio <hugo.locurcio@hugo.pro>2020-10-15 21:59:08 +0200
committerHugo Locurcio <hugo.locurcio@hugo.pro>2020-10-15 21:59:08 +0200
commit4357506e64784f84ada8d84caade8172a4f89a79 (patch)
tree53c6138f99c720bcf6a08941354dec59c5d21f3c /servers/rendering/rasterizer_rd/shaders/sky.glsl
parent4dce52e4cb0b5438ae22c3273ba5b1da12986dbe (diff)
Fix "fixed" fog drawing in front of volumetric fog with a sky background
This closes #42820. Co-authored-by: Clay John <claynjohn@gmail.com>
Diffstat (limited to 'servers/rendering/rasterizer_rd/shaders/sky.glsl')
-rw-r--r--servers/rendering/rasterizer_rd/shaders/sky.glsl9
1 files changed, 5 insertions, 4 deletions
diff --git a/servers/rendering/rasterizer_rd/shaders/sky.glsl b/servers/rendering/rasterizer_rd/shaders/sky.glsl
index 7b6de6a555..7711f683ae 100644
--- a/servers/rendering/rasterizer_rd/shaders/sky.glsl
+++ b/servers/rendering/rasterizer_rd/shaders/sky.glsl
@@ -223,13 +223,14 @@ FRAGMENT_SHADER_CODE
#if !defined(DISABLE_FOG) && !defined(USE_CUBEMAP_PASS)
- if (scene_data.volumetric_fog_enabled) {
- vec4 fog = volumetric_fog_process(uv);
+ // Draw "fixed" fog before volumetric fog to ensure volumetric fog can appear in front of the sky.
+ if (scene_data.fog_enabled) {
+ vec4 fog = fog_process(cube_normal);
frag_color.rgb = mix(frag_color.rgb, fog.rgb, fog.a);
}
- if (scene_data.fog_enabled) {
- vec4 fog = fog_process(cube_normal);
+ if (scene_data.volumetric_fog_enabled) {
+ vec4 fog = volumetric_fog_process(uv);
frag_color.rgb = mix(frag_color.rgb, fog.rgb, fog.a);
}