From 3764f53b1bd9c664d8c0e71b2176efadd21efe3d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Foucault?= Date: Fri, 11 Oct 2024 18:06:19 +0200 Subject: [PATCH] Fix: EEVEE: Point lights with zero radius create in shadow artifact This is likely caused by local_ray_up being degenerate with very small radii. This is a temporary fix and should be revisited later. The issue is that the real fix is likely to have a higher performance cost. Fix #124636 --- .../engines/eevee_next/shaders/eevee_shadow_tracing_lib.glsl | 3 +++ 1 file changed, 3 insertions(+) diff --git a/source/blender/draw/engines/eevee_next/shaders/eevee_shadow_tracing_lib.glsl b/source/blender/draw/engines/eevee_next/shaders/eevee_shadow_tracing_lib.glsl index 9c14c75ece4..d6874f0725b 100644 --- a/source/blender/draw/engines/eevee_next/shaders/eevee_shadow_tracing_lib.glsl +++ b/source/blender/draw/engines/eevee_next/shaders/eevee_shadow_tracing_lib.glsl @@ -238,6 +238,9 @@ ShadowRayPunctual shadow_ray_generate_punctual(LightData light, vec2 random_2d, float clip_far = intBitsToFloat(light.clip_far); float clip_near = intBitsToFloat(light.clip_near); float shape_radius = light_spot_data_get(light).shadow_radius; + /* Clamp to a minimum value to avoid `local_ray_up` being degenerate. Could be revisited as the + * issue might reappear at different zoom level. */ + shape_radius = max(0.00002, shape_radius); vec3 direction; if (is_area_light(light.type)) {