[Bf-blender-cvs] [51385f6] master: Fix T45447: Area light importance sampling improvement

Stefan Werner noreply at git.blender.org
Thu Jul 16 08:33:39 CEST 2015


Commit: 51385f6fe8e85aaed8a77d0314c15f8bdd0ef545
Author: Stefan Werner
Date:   Thu Jul 16 08:31:02 2015 +0200
Branches: master
https://developer.blender.org/rB51385f6fe8e85aaed8a77d0314c15f8bdd0ef545

Fix T45447: Area light importance sampling improvement

Turning on importance sampling on area lights increases noise on diffuse
surfaces. This was caused by PDF calculated for an intersected point on
light instead of original light position.

Patch by Stefan with some own modifications.

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

M	intern/cycles/kernel/kernel_light.h

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

diff --git a/intern/cycles/kernel/kernel_light.h b/intern/cycles/kernel/kernel_light.h
index 1badbc3..24d4b01 100644
--- a/intern/cycles/kernel/kernel_light.h
+++ b/intern/cycles/kernel/kernel_light.h
@@ -728,15 +728,15 @@ ccl_device bool lamp_light_eval(KernelGlobals *kg, int lamp, float3 P, float3 D,
 		if(dot(D, Ng) >= 0.0f)
 			return false;
 
-		ls->P = make_float3(data0.y, data0.z, data0.w);
+		float3 light_P = make_float3(data0.y, data0.z, data0.w);
 
 		if(!ray_quad_intersect(P, D, t,
-			ls->P, axisu, axisv, &ls->P, &ls->t))
+			light_P, axisu, axisv, &ls->P, &ls->t))
 			return false;
 
 		ls->D = D;
 		ls->Ng = Ng;
-		ls->pdf = area_light_sample(P, &ls->P, axisu, axisv, 0, 0, false);
+		ls->pdf = area_light_sample(P, &light_P, axisu, axisv, 0, 0, false);
 		ls->eval_fac = 0.25f*invarea;
 	}
 	else




More information about the Bf-blender-cvs mailing list