Instead of Vector2() start volumetric fog at frustum_near_size to avoid INF and NaN in shaders.

(cherry picked from commit 00c2fb4a08)
This commit is contained in:
viksl 2023-08-25 12:16:12 +02:00 committed by Yuri Sizov
parent c9e5f90813
commit ee6bdce5a1
1 changed files with 2 additions and 2 deletions

View File

@ -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;