From 6aa50832cf1caac3ca0d185295112da8f7018fac Mon Sep 17 00:00:00 2001 From: Miguel Pozo Date: Mon, 11 Mar 2024 12:23:07 +0100 Subject: [PATCH] Fix: EEVEE-Next: Workaround for Nvidia shader compiler Using the previously computed L breaks shadows on reflection probes, even if the value should be the same. Pull Request: https://projects.blender.org/blender/blender/pulls/119219 --- .../eevee_next/shaders/eevee_shadow_tracing_lib.glsl | 6 ++++++ 1 file changed, 6 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 31b5f6a7dbb..565a60cd0ea 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 @@ -472,6 +472,12 @@ vec3 shadow_pcf_offset(LightData light, const bool is_directional, vec3 P, vec3 /* Project the offset position into the surface */ +#ifdef GPU_NVIDIA + /* Workaround for a bug in the Nvidia shader compiler. + * If we don't compute L here again, it breaks shadows on reflection probes. */ + L = light_vector_get(light, is_directional, P).L; +#endif + if (abs(dot(Ng, L)) > 0.999) { return ws_offset; }