[Bf-blender-cvs] [5e5ec4c] master: Fix T39577: cycles issue mixing anisotropic BSDFs with branched path tracer.

Brecht Van Lommel noreply at git.blender.org
Thu Apr 3 16:00:03 CEST 2014


Commit: 5e5ec4c138de49005ea711d280e3e18794c9473d
Author: Brecht Van Lommel
Date:   Thu Apr 3 15:51:43 2014 +0200
https://developer.blender.org/rB5e5ec4c138de49005ea711d280e3e18794c9473d

Fix T39577: cycles issue mixing anisotropic BSDFs with branched path tracer.

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

M	intern/cycles/kernel/kernel_shader.h
M	intern/cycles/kernel/svm/svm_types.h

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

diff --git a/intern/cycles/kernel/kernel_shader.h b/intern/cycles/kernel/kernel_shader.h
index 716dd51..7aa9cfb 100644
--- a/intern/cycles/kernel/kernel_shader.h
+++ b/intern/cycles/kernel/kernel_shader.h
@@ -453,23 +453,32 @@ ccl_device void shader_merge_closures(ShaderData *sd)
 			ShaderClosure *scj = &sd->closure[j];
 
 #ifdef __OSL__
-			if(!sci->prim && !scj->prim && sci->type == scj->type && sci->data0 == scj->data0 && sci->data1 == scj->data1) {
-#else
-			if(sci->type == scj->type && sci->data0 == scj->data0 && sci->data1 == scj->data1) {
+			if(sci->prim || scj->prim)
+				continue;
 #endif
-				sci->weight += scj->weight;
-				sci->sample_weight += scj->sample_weight;
 
-				int size = sd->num_closure - (j+1);
-				if(size > 0) {
-					for(int k = 0; k < size; k++) {
-						scj[k] = scj[k+1];
-					}
-				}
+			if(!(sci->type == scj->type && sci->data0 == scj->data0 && sci->data1 == scj->data1))
+				continue;
 
-				sd->num_closure--;
-				j--;
+			if(CLOSURE_IS_BSDF_OR_BSSRDF(sci->type)) {
+				if(sci->N != scj->N)
+					continue;
+				else if(CLOSURE_IS_BSDF_ANISOTROPIC(sci->type) && sci->T != scj->T)
+					continue;
 			}
+
+			sci->weight += scj->weight;
+			sci->sample_weight += scj->sample_weight;
+
+			int size = sd->num_closure - (j+1);
+			if(size > 0) {
+				for(int k = 0; k < size; k++) {
+					scj[k] = scj[k+1];
+				}
+			}
+
+			sd->num_closure--;
+			j--;
 		}
 	}
 }
diff --git a/intern/cycles/kernel/svm/svm_types.h b/intern/cycles/kernel/svm/svm_types.h
index 3285ea5..4381bfe 100644
--- a/intern/cycles/kernel/svm/svm_types.h
+++ b/intern/cycles/kernel/svm/svm_types.h
@@ -402,6 +402,8 @@ typedef enum ClosureType {
 #define CLOSURE_IS_BSDF_GLOSSY(type) (type >= CLOSURE_BSDF_GLOSSY_ID && type <= CLOSURE_BSDF_HAIR_REFLECTION_ID)
 #define CLOSURE_IS_BSDF_TRANSMISSION(type) (type >= CLOSURE_BSDF_TRANSMISSION_ID && type <= CLOSURE_BSDF_HAIR_TRANSMISSION_ID)
 #define CLOSURE_IS_BSDF_BSSRDF(type) (type == CLOSURE_BSDF_BSSRDF_ID)
+#define CLOSURE_IS_BSDF_ANISOTROPIC(type) (type == CLOSURE_BSDF_WARD_ID)
+#define CLOSURE_IS_BSDF_OR_BSSRDF(type) (type <= CLOSURE_BSSRDF_GAUSSIAN_ID)
 #define CLOSURE_IS_BSSRDF(type) (type >= CLOSURE_BSSRDF_CUBIC_ID && type <= CLOSURE_BSSRDF_GAUSSIAN_ID)
 #define CLOSURE_IS_VOLUME(type) (type >= CLOSURE_VOLUME_ID && type <= CLOSURE_VOLUME_HENYEY_GREENSTEIN_ID)
 #define CLOSURE_IS_EMISSION(type) (type == CLOSURE_EMISSION_ID)




More information about the Bf-blender-cvs mailing list