diff options
author | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2014-04-03 17:51:43 +0400 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2014-04-03 17:59:39 +0400 |
commit | 5e5ec4c138de49005ea711d280e3e18794c9473d (patch) | |
tree | c18f6675fde374c0e399985eff5c8bb5c644613f | |
parent | 0102d57c1de344fc3dd14e93d0593ed616d29d7b (diff) |
Fix T39577: cycles issue mixing anisotropic BSDFs with branched path tracer.
-rw-r--r-- | intern/cycles/kernel/kernel_shader.h | 35 | ||||
-rw-r--r-- | intern/cycles/kernel/svm/svm_types.h | 2 |
2 files changed, 24 insertions, 13 deletions
diff --git a/intern/cycles/kernel/kernel_shader.h b/intern/cycles/kernel/kernel_shader.h index 716dd5127c1..7aa9cfbcccc 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 3285ea5cd31..4381bfe0996 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) |