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

This commit is contained in:
viksl 2023-08-25 12:16:12 +02:00
parent 6758a7f8c0
commit 00c2fb4a08

View file

@ -543,7 +543,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;
@ -1002,7 +1002,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;