diff options
author | RĂ©mi Verschelde <remi@verschelde.fr> | 2021-09-29 23:05:07 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-09-29 23:05:07 +0200 |
commit | 86a2e104dc7cb7532db92157f10e9cb6813c8efc (patch) | |
tree | 251d74f065dc3aa1813c09787206fe0eee868bc5 | |
parent | e1f7e4ef8f3d3da888ffc3f20115f81a5a782827 (diff) | |
parent | 485eac3d3fc63ad026f4ccb2aae2e479f58480af (diff) |
Merge pull request #53196 from manueldun/radialFogFix
-rw-r--r-- | servers/rendering/renderer_rd/shaders/scene_forward_clustered.glsl | 2 | ||||
-rw-r--r-- | servers/rendering/renderer_rd/shaders/scene_forward_mobile.glsl | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/servers/rendering/renderer_rd/shaders/scene_forward_clustered.glsl b/servers/rendering/renderer_rd/shaders/scene_forward_clustered.glsl index 8cb56fbc83..f0fb31a457 100644 --- a/servers/rendering/renderer_rd/shaders/scene_forward_clustered.glsl +++ b/servers/rendering/renderer_rd/shaders/scene_forward_clustered.glsl @@ -524,7 +524,7 @@ vec4 fog_process(vec3 vertex) { } } - float fog_amount = 1.0 - exp(min(0.0, vertex.z * scene_data.fog_density)); + float fog_amount = 1.0 - exp(min(0.0, -length(vertex) * scene_data.fog_density)); if (abs(scene_data.fog_height_density) > 0.001) { float y = (scene_data.camera_matrix * vec4(vertex, 1.0)).y; diff --git a/servers/rendering/renderer_rd/shaders/scene_forward_mobile.glsl b/servers/rendering/renderer_rd/shaders/scene_forward_mobile.glsl index c3c4139450..750ec5f00a 100644 --- a/servers/rendering/renderer_rd/shaders/scene_forward_mobile.glsl +++ b/servers/rendering/renderer_rd/shaders/scene_forward_mobile.glsl @@ -550,7 +550,7 @@ vec4 fog_process(vec3 vertex) { } } - float fog_amount = 1.0 - exp(min(0.0, vertex.z * scene_data.fog_density)); + float fog_amount = 1.0 - exp(min(0.0, -length(vertex) * scene_data.fog_density)); if (abs(scene_data.fog_height_density) > 0.001) { float y = (scene_data.camera_matrix * vec4(vertex, 1.0)).y; |