diff options
Diffstat (limited to 'intern')
-rw-r--r-- | intern/cycles/kernel/closure/bsdf_microfacet.h | 4 | ||||
-rw-r--r-- | intern/cycles/kernel/osl/osl_closures.cpp | 18 | ||||
-rw-r--r-- | intern/cycles/kernel/svm/svm_closure.h | 16 |
3 files changed, 37 insertions, 1 deletions
diff --git a/intern/cycles/kernel/closure/bsdf_microfacet.h b/intern/cycles/kernel/closure/bsdf_microfacet.h index 18b645e0ecb..2dd59354058 100644 --- a/intern/cycles/kernel/closure/bsdf_microfacet.h +++ b/intern/cycles/kernel/closure/bsdf_microfacet.h @@ -336,7 +336,9 @@ ccl_device bool bsdf_microfacet_merge(const ShaderClosure *a, const ShaderClosur (bsdf_a->ior == bsdf_b->ior) && ((bsdf_a->extra == NULL && bsdf_b->extra == NULL) || ((bsdf_a->extra && bsdf_b->extra) && - (isequal_float3(bsdf_a->extra->color, bsdf_b->extra->color)))); + (isequal_float3(bsdf_a->extra->color, bsdf_b->extra->color)) && + (isequal_float3(bsdf_a->extra->cspec0, bsdf_b->extra->cspec0)) && + (bsdf_a->extra->clearcoat == bsdf_b->extra->clearcoat))); } ccl_device int bsdf_microfacet_ggx_aniso_setup(MicrofacetBsdf *bsdf) diff --git a/intern/cycles/kernel/osl/osl_closures.cpp b/intern/cycles/kernel/osl/osl_closures.cpp index 608e856e019..c52230de86e 100644 --- a/intern/cycles/kernel/osl/osl_closures.cpp +++ b/intern/cycles/kernel/osl/osl_closures.cpp @@ -194,10 +194,12 @@ public: return NULL; } + bsdf->T = make_float3(0.0f, 0.0f, 0.0f); bsdf->extra = extra; bsdf->ior = 1.5f; bsdf->alpha_x = clearcoat_roughness; bsdf->alpha_y = clearcoat_roughness; + bsdf->extra->color = make_float3(0.0f, 0.0f, 0.0f); bsdf->extra->cspec0 = make_float3(0.04f, 0.04f, 0.04f); bsdf->extra->clearcoat = clearcoat; return bsdf; @@ -379,6 +381,7 @@ public: bsdf->extra = extra; bsdf->extra->color = color; bsdf->extra->cspec0 = cspec0; + bsdf->extra->clearcoat = 0.0f; return bsdf; } }; @@ -388,6 +391,8 @@ public: void setup(ShaderData *sd, int path_flag, float3 weight) { MicrofacetBsdf *bsdf = alloc(sd, path_flag, weight); + bsdf->T = make_float3(0.0f, 0.0f, 0.0f); + bsdf->alpha_y = bsdf->alpha_x; sd->flag |= (bsdf) ? bsdf_microfacet_ggx_fresnel_setup(bsdf, sd) : 0; } }; @@ -462,6 +467,8 @@ public: bsdf->extra = extra; bsdf->extra->color = color; + bsdf->extra->cspec0 = make_float3(0.0f, 0.0f, 0.0f); + bsdf->extra->clearcoat = 0.0f; return bsdf; } }; @@ -471,6 +478,9 @@ public: void setup(ShaderData *sd, int path_flag, float3 weight) { MicrofacetBsdf *bsdf = alloc(sd, path_flag, weight); + bsdf->ior = 0.0f; + bsdf->T = make_float3(0.0f, 0.0f, 0.0f); + bsdf->alpha_y = bsdf->alpha_x; sd->flag |= (bsdf) ? bsdf_microfacet_multi_ggx_setup(bsdf) : 0; } }; @@ -493,6 +503,7 @@ public: void setup(ShaderData *sd, int path_flag, float3 weight) { MicrofacetBsdf *bsdf = alloc(sd, path_flag, weight); + bsdf->ior = 0.0f; sd->flag |= (bsdf) ? bsdf_microfacet_multi_ggx_aniso_setup(bsdf) : 0; } }; @@ -519,6 +530,8 @@ public: void setup(ShaderData *sd, int path_flag, float3 weight) { MicrofacetBsdf *bsdf = alloc(sd, path_flag, weight); + bsdf->T = make_float3(0.0f, 0.0f, 0.0f); + bsdf->alpha_y = bsdf->alpha_x; sd->flag |= (bsdf) ? bsdf_microfacet_multi_ggx_glass_setup(bsdf) : 0; } }; @@ -568,6 +581,7 @@ public: bsdf->extra = extra; bsdf->extra->color = color; bsdf->extra->cspec0 = cspec0; + bsdf->extra->clearcoat = 0.0f; return bsdf; } }; @@ -577,6 +591,8 @@ public: void setup(ShaderData *sd, int path_flag, float3 weight) { MicrofacetBsdf *bsdf = alloc(sd, path_flag, weight); + bsdf->T = make_float3(0.0f, 0.0f, 0.0f); + bsdf->alpha_y = bsdf->alpha_x; sd->flag |= (bsdf) ? bsdf_microfacet_multi_ggx_fresnel_setup(bsdf, sd) : 0; } }; @@ -629,6 +645,8 @@ public: void setup(ShaderData *sd, int path_flag, float3 weight) { MicrofacetBsdf *bsdf = alloc(sd, path_flag, weight); + bsdf->T = make_float3(0.0f, 0.0f, 0.0f); + bsdf->alpha_y = bsdf->alpha_x; sd->flag |= (bsdf) ? bsdf_microfacet_multi_ggx_glass_fresnel_setup(bsdf, sd) : 0; } }; diff --git a/intern/cycles/kernel/svm/svm_closure.h b/intern/cycles/kernel/svm/svm_closure.h index 5a5cf2db401..7fc96f7e47f 100644 --- a/intern/cycles/kernel/svm/svm_closure.h +++ b/intern/cycles/kernel/svm/svm_closure.h @@ -268,6 +268,7 @@ ccl_device void svm_node_closure_bsdf(KernelGlobals *kg, ShaderData *sd, float * bsdf->extra->cspec0 = (specular * 0.08f * tmp_col) * (1.0f - metallic) + base_color * metallic; bsdf->extra->color = base_color; + bsdf->extra->clearcoat = 0.0f; /* setup bsdf */ if(distribution == CLOSURE_BSDF_MICROFACET_GGX_GLASS_ID || roughness <= 0.075f) /* use single-scatter GGX */ @@ -306,6 +307,7 @@ ccl_device void svm_node_closure_bsdf(KernelGlobals *kg, ShaderData *sd, float * } bsdf->N = N; + bsdf->T = make_float3(0.0f, 0.0f, 0.0f); bsdf->extra = extra; bsdf->alpha_x = refl_roughness * refl_roughness; @@ -314,6 +316,7 @@ ccl_device void svm_node_closure_bsdf(KernelGlobals *kg, ShaderData *sd, float * bsdf->extra->color = base_color; bsdf->extra->cspec0 = cspec0; + bsdf->extra->clearcoat = 0.0f; /* setup bsdf */ sd->flag |= bsdf_microfacet_ggx_fresnel_setup(bsdf, sd); @@ -365,6 +368,7 @@ ccl_device void svm_node_closure_bsdf(KernelGlobals *kg, ShaderData *sd, float * bsdf->extra->color = base_color; bsdf->extra->cspec0 = cspec0; + bsdf->extra->clearcoat = 0.0f; /* setup bsdf */ sd->flag |= bsdf_microfacet_multi_ggx_glass_fresnel_setup(bsdf, sd); @@ -390,12 +394,14 @@ ccl_device void svm_node_closure_bsdf(KernelGlobals *kg, ShaderData *sd, float * } bsdf->N = clearcoat_normal; + bsdf->T = make_float3(0.0f, 0.0f, 0.0f); bsdf->ior = 1.5f; bsdf->extra = extra; bsdf->alpha_x = clearcoat_roughness * clearcoat_roughness; bsdf->alpha_y = clearcoat_roughness * clearcoat_roughness; + bsdf->extra->color = make_float3(0.0f, 0.0f, 0.0f); bsdf->extra->cspec0 = make_float3(0.04f, 0.04f, 0.04f); bsdf->extra->clearcoat = clearcoat; @@ -460,6 +466,7 @@ ccl_device void svm_node_closure_bsdf(KernelGlobals *kg, ShaderData *sd, float * } bsdf->N = N; + bsdf->T = make_float3(0.0f, 0.0f, 0.0f); bsdf->alpha_x = param1; bsdf->alpha_y = param1; bsdf->ior = 0.0f; @@ -477,6 +484,8 @@ ccl_device void svm_node_closure_bsdf(KernelGlobals *kg, ShaderData *sd, float * bsdf->extra = (MicrofacetExtra*)closure_alloc_extra(sd, sizeof(MicrofacetExtra)); if(bsdf->extra) { bsdf->extra->color = stack_load_float3(stack, data_node.z); + bsdf->extra->cspec0 = make_float3(0.0f, 0.0f, 0.0f); + bsdf->extra->clearcoat = 0.0f; sd->flag |= bsdf_microfacet_multi_ggx_setup(bsdf); } } @@ -498,6 +507,7 @@ ccl_device void svm_node_closure_bsdf(KernelGlobals *kg, ShaderData *sd, float * if(bsdf) { bsdf->N = N; + bsdf->T = make_float3(0.0f, 0.0f, 0.0f); bsdf->extra = NULL; float eta = fmaxf(param2, 1e-5f); @@ -555,6 +565,7 @@ ccl_device void svm_node_closure_bsdf(KernelGlobals *kg, ShaderData *sd, float * if(bsdf) { bsdf->N = N; + bsdf->T = make_float3(0.0f, 0.0f, 0.0f); bsdf->extra = NULL; svm_node_glass_setup(sd, bsdf, type, eta, roughness, false); } @@ -569,6 +580,7 @@ ccl_device void svm_node_closure_bsdf(KernelGlobals *kg, ShaderData *sd, float * if(bsdf) { bsdf->N = N; + bsdf->T = make_float3(0.0f, 0.0f, 0.0f); bsdf->extra = NULL; svm_node_glass_setup(sd, bsdf, type, eta, roughness, true); } @@ -603,6 +615,8 @@ ccl_device void svm_node_closure_bsdf(KernelGlobals *kg, ShaderData *sd, float * kernel_assert(stack_valid(data_node.z)); bsdf->extra->color = stack_load_float3(stack, data_node.z); + bsdf->extra->cspec0 = make_float3(0.0f, 0.0f, 0.0f); + bsdf->extra->clearcoat = 0.0f; /* setup bsdf */ sd->flag |= bsdf_microfacet_multi_ggx_glass_setup(bsdf); @@ -656,6 +670,8 @@ ccl_device void svm_node_closure_bsdf(KernelGlobals *kg, ShaderData *sd, float * bsdf->extra = (MicrofacetExtra*)closure_alloc_extra(sd, sizeof(MicrofacetExtra)); if(bsdf->extra) { bsdf->extra->color = stack_load_float3(stack, data_node.w); + bsdf->extra->cspec0 = make_float3(0.0f, 0.0f, 0.0f); + bsdf->extra->clearcoat = 0.0f; sd->flag |= bsdf_microfacet_multi_ggx_aniso_setup(bsdf); } } |