From 91fd6b18f335ebd8facb59cf9ec95a5a34c472dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Foucault?= Date: Sun, 10 Dec 2023 21:35:57 +0100 Subject: [PATCH] Fix #115288: EEVEE-Next: Horizon Scan light leaking This was caused by the normal test being wrong and not taken into account at all. --- .../eevee_next/shaders/eevee_horizon_scan_eval_lib.glsl | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/source/blender/draw/engines/eevee_next/shaders/eevee_horizon_scan_eval_lib.glsl b/source/blender/draw/engines/eevee_next/shaders/eevee_horizon_scan_eval_lib.glsl index ba06186b7d4..50a78be3ca0 100644 --- a/source/blender/draw/engines/eevee_next/shaders/eevee_horizon_scan_eval_lib.glsl +++ b/source/blender/draw/engines/eevee_next/shaders/eevee_horizon_scan_eval_lib.glsl @@ -171,22 +171,22 @@ void horizon_scan_context_sample_finish( * The paper suggests a smooth test which is not physically correct since we * already consider the sample reflected radiance. * Set the weight to allow energy conservation. If we modulate the radiance, we loose energy. */ - float weight = step(dot(sample_normal, -L), 0.0); + float weight = step(dot(sample_normal, L), 0.0); #ifdef HORIZON_OCCLUSION horizon_scan_context_sample_finish(ctx.occlusion_common, sample_radiance, 1.0, theta, bias); #endif #ifdef HORIZON_DIFFUSE - weight = bxdf_eval(ctx.diffuse, L, V); + weight *= bxdf_eval(ctx.diffuse, L, V); horizon_scan_context_sample_finish(ctx.diffuse_common, sample_radiance, weight, theta, bias); #endif #ifdef HORIZON_REFLECT - weight = bxdf_eval(ctx.reflection, L, V); + weight *= bxdf_eval(ctx.reflection, L, V); horizon_scan_context_sample_finish(ctx.reflection_common, sample_radiance, weight, theta, bias); #endif #ifdef HORIZON_REFRACT /* TODO(fclem): Broken: Black. */ - weight = bxdf_eval(ctx.refraction, L, V); + weight *= bxdf_eval(ctx.refraction, L, V); horizon_scan_context_sample_finish(ctx.refraction_common, sample_radiance, weight, theta, bias); #endif }