[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [53703] trunk/blender/intern/cycles/kernel /kernel_light.h: Fix too bright result in background multiple importance after recent changes .

Brecht Van Lommel brechtvanlommel at pandora.be
Thu Jan 10 13:35:10 CET 2013


Revision: 53703
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=53703
Author:   blendix
Date:     2013-01-10 12:35:09 +0000 (Thu, 10 Jan 2013)
Log Message:
-----------
Fix too bright result in background multiple importance after recent changes.

Modified Paths:
--------------
    trunk/blender/intern/cycles/kernel/kernel_light.h

Modified: trunk/blender/intern/cycles/kernel/kernel_light.h
===================================================================
--- trunk/blender/intern/cycles/kernel/kernel_light.h	2013-01-10 12:32:09 UTC (rev 53702)
+++ trunk/blender/intern/cycles/kernel/kernel_light.h	2013-01-10 12:35:09 UTC (rev 53703)
@@ -243,7 +243,7 @@
 
 		float costheta = dot(lightD, D);
 		ls->pdf = invarea/(costheta*costheta*costheta);
-		ls->eval_fac = ls->pdf;
+		ls->eval_fac = ls->pdf*kernel_data.integrator.inv_pdf_lights;
 	}
 #ifdef __BACKGROUND_MIS__
 	else if(type == LIGHT_BACKGROUND) {
@@ -302,23 +302,18 @@
 				invarea = 1.0f;
 			}
 
-			ls->pdf = invarea;
 			ls->eval_fac = 0.25f*ls->pdf;
+			ls->pdf = invarea;
 		}
+
+		ls->eval_fac *= kernel_data.integrator.inv_pdf_lights;
+		ls->pdf *= lamp_light_pdf(kg, ls->Ng, -ls->D, ls->t);
 	}
 
 	ls->shader = __float_as_int(data1.x);
 	ls->object = ~0;
 	ls->prim = ~0;
 	ls->lamp = lamp;
-
-	/* compute pdf */
-	if(ls->t != FLT_MAX)
-		ls->pdf *= lamp_light_pdf(kg, ls->Ng, -ls->D, ls->t);
-	
-	/* this is a bit weak, but we don't want this as part of the pdf for
-	 * multiple importance sampling */
-	ls->eval_fac *= kernel_data.integrator.inv_pdf_lights;
 }
 
 __device bool lamp_light_eval(KernelGlobals *kg, int lamp, float3 P, float3 D, float t, LightSample *ls)




More information about the Bf-blender-cvs mailing list