[Bf-blender-cvs] [08bf531] master: Cycles-Bake: Ambient Occlusion needs to be computed for COMBINED

Dalai Felinto noreply at git.blender.org
Wed May 7 15:19:04 CEST 2014


Commit: 08bf531956b1c1cff3319d119e8aba55b7a09b9e
Author: Dalai Felinto
Date:   Wed May 7 10:17:56 2014 -0300
https://developer.blender.org/rB08bf531956b1c1cff3319d119e8aba55b7a09b9e

Cycles-Bake: Ambient Occlusion needs to be computed for COMBINED

Now the COMBINED pass includes the Ambient Occlusion.

This was not reported anywhere, but while working in the Subsurface Scattering I realize we needed this fix for combined.

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

M	intern/cycles/kernel/kernel_displace.h

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

diff --git a/intern/cycles/kernel/kernel_displace.h b/intern/cycles/kernel/kernel_displace.h
index 465d4dd..012f399 100644
--- a/intern/cycles/kernel/kernel_displace.h
+++ b/intern/cycles/kernel/kernel_displace.h
@@ -16,7 +16,8 @@
 
 CCL_NAMESPACE_BEGIN
 
-ccl_device void compute_light_pass(KernelGlobals *kg, ShaderData *sd, PathRadiance *L, RNG rng, bool is_ao)
+ccl_device void compute_light_pass(KernelGlobals *kg, ShaderData *sd, PathRadiance *L, RNG rng,
+                                   bool is_combined, bool is_ao)
 {
 	int samples = kernel_data.integrator.aa_samples;
 
@@ -45,22 +46,24 @@ ccl_device void compute_light_pass(KernelGlobals *kg, ShaderData *sd, PathRadian
 		/* TODO, disable the closures we won't need */
 
 		/* sample ambient occlusion */
-		if(is_ao) {
+		if(is_combined || is_ao) {
 			kernel_path_ao(kg, sd, &L_sample, &state, &rng, throughput);
 		}
 
 		/* sample light and BSDF */
-		else if(kernel_path_integrate_lighting(kg, &rng, sd, &throughput, &state, &L_sample, &ray)) {
+		if(!is_ao) {
+			if(kernel_path_integrate_lighting(kg, &rng, sd, &throughput, &state, &L_sample, &ray)) {
 #ifdef __LAMP_MIS__
-			state.ray_t = 0.0f;
+				state.ray_t = 0.0f;
 #endif
 
-			/* compute indirect light */
-			kernel_path_indirect(kg, &rng, ray, throughput, state.num_samples, state, &L_sample);
+				/* compute indirect light */
+				kernel_path_indirect(kg, &rng, ray, throughput, state.num_samples, state, &L_sample);
 
-			/* sum and reset indirect light pass variables for the next samples */
-			path_radiance_sum_indirect(&L_sample);
-			path_radiance_reset_indirect(&L_sample);
+				/* sum and reset indirect light pass variables for the next samples */
+				path_radiance_sum_indirect(&L_sample);
+				path_radiance_reset_indirect(&L_sample);
+			}
 		}
 
 		/* accumulate into master L */
@@ -123,7 +126,8 @@ ccl_device void kernel_bake_evaluate(KernelGlobals *kg, ccl_global uint4 *input,
 
 	if(is_light_pass(type)) {
 		RNG rng = cmj_hash(i, 0);
-		compute_light_pass(kg, &sd, &L, rng, (type == SHADER_EVAL_AO));
+		compute_light_pass(kg, &sd, &L, rng, (type == SHADER_EVAL_COMBINED),
+		                                     (type == SHADER_EVAL_AO));
 	}
 
 	switch (type) {




More information about the Bf-blender-cvs mailing list