From ee6bdce5a1824fecf7a0dece0f3770e5cdcbc1d9 Mon Sep 17 00:00:00 2001 From: viksl <33526847+viksl@users.noreply.github.com> Date: Fri, 25 Aug 2023 12:16:12 +0200 Subject: [PATCH] Instead of Vector2() start volumetric fog at frustum_near_size to avoid INF and NaN in shaders. (cherry picked from commit 00c2fb4a08ab83a623f388718869a818658434c5) --- servers/rendering/renderer_rd/environment/fog.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/servers/rendering/renderer_rd/environment/fog.cpp b/servers/rendering/renderer_rd/environment/fog.cpp index a836776bbbd..b2f4f085ac5 100644 --- a/servers/rendering/renderer_rd/environment/fog.cpp +++ b/servers/rendering/renderer_rd/environment/fog.cpp @@ -561,7 +561,7 @@ void Fog::volumetric_fog_update(const VolumetricFogSettings &p_settings, const P if (p_cam_projection.is_orthogonal()) { fog_near_size = fog_far_size; } else { - fog_near_size = Vector2(); + fog_near_size = frustum_near_size.max(Vector2(0.001, 0.001)); } params.fog_frustum_size_begin[0] = fog_near_size.x; @@ -1020,7 +1020,7 @@ void Fog::volumetric_fog_update(const VolumetricFogSettings &p_settings, const P if (p_cam_projection.is_orthogonal()) { fog_near_size = fog_far_size; } else { - fog_near_size = Vector2(); + fog_near_size = frustum_near_size.max(Vector2(0.001, 0.001)); } params.fog_frustum_size_begin[0] = fog_near_size.x;