[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [45752] branches/soc-2011-tomato/intern/ cycles/kernel: Cycles: environment pass will now render environment even if film is set to

Brecht Van Lommel brechtvanlommel at pandora.be
Wed Apr 18 17:21:46 CEST 2012


Revision: 45752
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=45752
Author:   blendix
Date:     2012-04-18 15:21:46 +0000 (Wed, 18 Apr 2012)
Log Message:
-----------
Cycles: environment pass will now render environment even if film is set to
transparent.

Modified Paths:
--------------
    branches/soc-2011-tomato/intern/cycles/kernel/kernel_accumulate.h
    branches/soc-2011-tomato/intern/cycles/kernel/kernel_path.h

Modified: branches/soc-2011-tomato/intern/cycles/kernel/kernel_accumulate.h
===================================================================
--- branches/soc-2011-tomato/intern/cycles/kernel/kernel_accumulate.h	2012-04-18 15:09:13 UTC (rev 45751)
+++ branches/soc-2011-tomato/intern/cycles/kernel/kernel_accumulate.h	2012-04-18 15:21:46 UTC (rev 45752)
@@ -266,7 +266,7 @@
 #endif
 }
 
-__device_inline float3 path_radiance_sum(PathRadiance *L)
+__device_inline float3 path_radiance_sum(KernelGlobals *kg, PathRadiance *L)
 {
 #ifdef __PASSES__
 	if(L->use_light_pass) {
@@ -283,9 +283,14 @@
 		L->indirect_glossy *= L->indirect;
 		L->indirect_transmission *= L->indirect;
 
-		return L->emission + L->background
+		float3 L_sum = L->emission
 			+ L->direct_diffuse + L->direct_glossy + L->direct_transmission
 			+ L->indirect_diffuse + L->indirect_glossy + L->indirect_transmission;
+
+		if(!kernel_data.background.transparent)
+			L_sum += L->background;
+
+		return L_sum;
 	}
 	else
 		return L->emission;

Modified: branches/soc-2011-tomato/intern/cycles/kernel/kernel_path.h
===================================================================
--- branches/soc-2011-tomato/intern/cycles/kernel/kernel_path.h	2012-04-18 15:09:13 UTC (rev 45751)
+++ branches/soc-2011-tomato/intern/cycles/kernel/kernel_path.h	2012-04-18 15:21:46 UTC (rev 45752)
@@ -240,13 +240,17 @@
 			/* eval background shader if nothing hit */
 			if(kernel_data.background.transparent && (state.flag & PATH_RAY_CAMERA)) {
 				L_transparent += average(throughput);
+
+#ifdef __PASSES__
+				if(!(kernel_data.film.pass_flag & PASS_BACKGROUND))
+#endif
+					break;
 			}
+
 #ifdef __BACKGROUND__
-			else {
-				/* sample background shader */
-				float3 L_background = indirect_background(kg, &ray, state.flag, ray_pdf);
-				path_radiance_accum_background(&L, throughput, L_background, state.bounce);
-			}
+			/* sample background shader */
+			float3 L_background = indirect_background(kg, &ray, state.flag, ray_pdf);
+			path_radiance_accum_background(&L, throughput, L_background, state.bounce);
 #endif
 
 			break;
@@ -409,7 +413,7 @@
 #endif
 	}
 
-	float3 L_sum = path_radiance_sum(&L);
+	float3 L_sum = path_radiance_sum(kg, &L);
 
 #ifdef __CLAMP_SAMPLE__
 	path_radiance_clamp(&L, &L_sum, kernel_data.integrator.sample_clamp);




More information about the Bf-blender-cvs mailing list