Skip to content

Commit 888883d

Browse files
committed
Merge pull request #100862 from Flarkk/fix_100850
Fix regression with shadows when light range is 0 or close
2 parents efa1443 + c9632d0 commit 888883d

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

servers/rendering/renderer_scene_cull.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -2510,7 +2510,7 @@ bool RendererSceneCull::_light_instance_update_shadow(Instance *p_instance, cons
25102510
}
25112511

25122512
real_t radius = RSG::light_storage->light_get_param(p_instance->base, RS::LIGHT_PARAM_RANGE);
2513-
real_t z_near = 0.005f;
2513+
real_t z_near = MIN(0.005f, radius);
25142514
Projection cm;
25152515
cm.set_perspective(90, 1, z_near, radius);
25162516

@@ -2600,7 +2600,7 @@ bool RendererSceneCull::_light_instance_update_shadow(Instance *p_instance, cons
26002600

26012601
real_t radius = RSG::light_storage->light_get_param(p_instance->base, RS::LIGHT_PARAM_RANGE);
26022602
real_t angle = RSG::light_storage->light_get_param(p_instance->base, RS::LIGHT_PARAM_SPOT_ANGLE);
2603-
real_t z_near = 0.005f;
2603+
real_t z_near = MIN(0.005f, radius);
26042604

26052605
Projection cm;
26062606
cm.set_perspective(angle * 2.0, 1.0, z_near, radius);

0 commit comments

Comments
 (0)