[Bf-blender-cvs] [1b5db02a020] master: Fix Cycles MNEE wrong results with area light spread

Olivier Maury noreply at git.blender.org
Thu Jul 14 16:36:16 CEST 2022


Commit: 1b5db02a0207621a0325c0d2ee6f748b2520d2fe
Author: Olivier Maury
Date:   Thu Jul 14 15:59:26 2022 +0200
Branches: master
https://developer.blender.org/rB1b5db02a0207621a0325c0d2ee6f748b2520d2fe

Fix Cycles MNEE wrong results with area light spread

When the solve is successful, the light sample needs to be updated since the
effective shading point is now on the last refractive interface. Spread was
not taken into account, creating false caustics.

Differential Revision: https://developer.blender.org/D15449

===================================================================

M	intern/cycles/kernel/integrator/mnee.h

===================================================================

diff --git a/intern/cycles/kernel/integrator/mnee.h b/intern/cycles/kernel/integrator/mnee.h
index 67505b9b612..70b009d3b48 100644
--- a/intern/cycles/kernel/integrator/mnee.h
+++ b/intern/cycles/kernel/integrator/mnee.h
@@ -137,8 +137,14 @@ ccl_device_forceinline void mnee_update_light_sample(KernelGlobals kg,
     }
   }
   else if (ls->type == LIGHT_AREA) {
+    float invarea = fabsf(klight->area.invarea);
     ls->D = normalize_len(ls->P - P, &ls->t);
-    ls->pdf = fabsf(klight->area.invarea);
+    ls->pdf = invarea;
+    if (klight->area.tan_spread > 0.f) {
+      ls->eval_fac = 0.25f * invarea;
+      ls->eval_fac *= light_spread_attenuation(
+          ls->D, ls->Ng, klight->area.tan_spread, klight->area.normalize_spread);
+    }
   }
 
   ls->pdf *= kernel_data.integrator.pdf_lights;



More information about the Bf-blender-cvs mailing list