Commit: f80dcb4f34f1dc41841ced5965787fc26ace22a2
Author: Pascal Schoen
Date:   Fri Dec 2 13:55:12 2016 +0100
Branches: cycles_disney_bsdf_transmittance
https://developer.blender.org/rBf80dcb4f34f1dc41841ced5965787fc26ace22a2

Removed reflection call when roughness is low because of artifacts.

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

M       intern/cycles/kernel/svm/svm_closure.h

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

diff --git a/intern/cycles/kernel/svm/svm_closure.h 
b/intern/cycles/kernel/svm/svm_closure.h
index 5246e74..bfcd2a2 100644
--- a/intern/cycles/kernel/svm/svm_closure.h
+++ b/intern/cycles/kernel/svm/svm_closure.h
@@ -263,32 +263,32 @@ ccl_device void svm_node_closure_bsdf(KernelGlobals *kg, 
ShaderData *sd, float *
                                if(specular_weight > CLOSURE_WEIGHT_CUTOFF && 
(specular > CLOSURE_WEIGHT_CUTOFF || metallic > CLOSURE_WEIGHT_CUTOFF)) {
                                        float3 spec_weight = weight * 
specular_weight;
 
-                                       /* for roughness values close to 0 
handle as a sharp reflection */
-                                       if(roughness <= 1e-2f) {
-                                               float spec_to_ior = (2.0f / 
(1.0f - safe_sqrtf(0.08f * specular))) - 1.0f;
+                                       ///* for roughness values close to 0 
handle as a sharp reflection */
+                                       //if(roughness <= 1e-2f) {
+                                       //      float spec_to_ior = (2.0f / 
(1.0f - safe_sqrtf(0.08f * specular))) - 1.0f;
 
-                                               float m_cdlum = 
linear_rgb_to_gray(base_color);
-                                               float3 m_ctint = m_cdlum > 0.0f 
? base_color / m_cdlum : make_float3(0.0f, 0.0f, 0.0f); // normalize lum. to 
isolate hue+sat
-                                               float3 tmp_col = 
make_float3(1.0f, 1.0f, 1.0f) * (1.0f - specular_tint) + m_ctint * 
specular_tint;
-                                               float3 cspec0 = (specular * 
0.08f * tmp_col) * (1.0f - metallic) + base_color * metallic;
+                                       //      float m_cdlum = 
linear_rgb_to_gray(base_color);
+                                       //      float3 m_ctint = m_cdlum > 0.0f 
? base_color / m_cdlum : make_float3(0.0f, 0.0f, 0.0f); // normalize lum. to 
isolate hue+sat
+                                       //      float3 tmp_col = 
make_float3(1.0f, 1.0f, 1.0f) * (1.0f - specular_tint) + m_ctint * 
specular_tint;
+                                       //      float3 cspec0 = (specular * 
0.08f * tmp_col) * (1.0f - metallic) + base_color * metallic;
 
-                                               float F0 = 
fresnel_dielectric_cos(1.0f, spec_to_ior);
-                                               float F0_norm = 1.0f / (1.0f - 
F0);
-                                               float FH = 
(fresnel_dielectric_cos(cosNO, spec_to_ior) - F0) * F0_norm;
+                                       //      float F0 = 
fresnel_dielectric_cos(1.0f, spec_to_ior);
+                                       //      float F0_norm = 1.0f / (1.0f - 
F0);
+                                       //      float FH = 
(fresnel_dielectric_cos(cosNO, spec_to_ior) - F0) * F0_norm;
 
-                                               /* Blend between white and a 
specular color with respect to the fresnel */
-                                               float3 refl_color = cspec0 * 
(1.0f - FH) + make_float3(1.0f, 1.0f, 1.0f) * FH;
+                                       //      /* Blend between white and a 
specular color with respect to the fresnel */
+                                       //      float3 refl_color = cspec0 * 
(1.0f - FH) + make_float3(1.0f, 1.0f, 1.0f) * FH;
 
-                                               MicrofacetBsdf *bsdf = 
(MicrofacetBsdf*)bsdf_alloc(sd, sizeof(MicrofacetBsdf), spec_weight*refl_color);
+                                       //      MicrofacetBsdf *bsdf = 
(MicrofacetBsdf*)bsdf_alloc(sd, sizeof(MicrofacetBsdf), spec_weight*refl_color);
 
-                                               if(bsdf) {
-                                                       bsdf->N = N;
+                                       //      if(bsdf) {
+                                       //              bsdf->N = N;
 
-                                                       /* setup bsdf */
-                                                       ccl_fetch(sd, flag) |= 
bsdf_reflection_setup(bsdf);
-                                               }
-                                       }
-                                       else {
+                                       //              /* setup bsdf */
+                                       //              ccl_fetch(sd, flag) |= 
bsdf_reflection_setup(bsdf);
+                                       //      }
+                                       //}
+                                       //else {
                                                MicrofacetBsdf *bsdf = 
(MicrofacetBsdf*)bsdf_alloc(sd, sizeof(MicrofacetBsdf), spec_weight);
                                                MicrofacetExtra *extra = 
(MicrofacetExtra*)closure_alloc_extra(sd, sizeof(MicrofacetExtra));
 
@@ -317,7 +317,7 @@ ccl_device void svm_node_closure_bsdf(KernelGlobals *kg, 
ShaderData *sd, float *
                                                        else /* use 
multi-scatter GGX */
                                                                ccl_fetch(sd, 
flag) |= bsdf_microfacet_multi_ggx_aniso_fresnel_setup(bsdf);
                                                }
-                                       }
+                                       //}
                                }
 #ifdef __CAUSTICS_TRICKS__
                        }
@@ -340,24 +340,24 @@ ccl_device void svm_node_closure_bsdf(KernelGlobals *kg, 
ShaderData *sd, float *
 #endif
                                                {
                                                        /* for roughness values 
close to 0 handle as a sharp reflection */
-                                                       if(roughness <= 1e-2f) {
-                                                               float F0 = 
fresnel_dielectric_cos(1.0f, ior);
-                                                               float F0_norm = 
1.0f / (1.0f - F0);
-                                                               float FH = 
(fresnel - F0) * F0_norm;
+                                                       //if(roughness <= 
1e-2f) {
+                                                       //      float F0 = 
fresnel_dielectric_cos(1.0f, ior);
+                                                       //      float F0_norm = 
1.0f / (1.0f - F0);
+                                                       //      float FH = 
(fresnel - F0) * F0_norm;
 
-                                                               /* Blend 
between white and a specular color with respect to the fresnel */
-                                                               float3 
refl_color = cspec0 * (1.0f - FH) + make_float3(1.0f, 1.0f, 1.0f) * FH;
+                                                       //      /* Blend 
between white and a specular color with respect to the fresnel */
+                                                       //      float3 
refl_color = cspec0 * (1.0f - FH) + make_float3(1.0f, 1.0f, 1.0f) * FH;
 
-                                                               MicrofacetBsdf 
*bsdf = (MicrofacetBsdf*)bsdf_alloc(sd, sizeof(MicrofacetBsdf), 
refl_color*glass_weight*fresnel);
+                                                       //      MicrofacetBsdf 
*bsdf = (MicrofacetBsdf*)bsdf_alloc(sd, sizeof(MicrofacetBsdf), 
refl_color*glass_weight*fresnel);
 
-                                                               if(bsdf) {
-                                                                       bsdf->N 
= N;
+                                                       //      if(bsdf) {
+                                                       //              bsdf->N 
= N;
 
-                                                                       /* 
setup bsdf */
-                                                                       
ccl_fetch(sd, flag) |= bsdf_reflection_setup(bsdf);
-                                                               }
-                                                       }
-                                                       else {
+                                                       //              /* 
setup bsdf */
+                                                       //              
ccl_fetch(sd, flag) |= bsdf_reflection_setup(bsdf);
+                                                       //      }
+                                                       //}
+                                                       //else {
                                                                MicrofacetBsdf 
*bsdf = (MicrofacetBsdf*)bsdf_alloc(sd, sizeof(MicrofacetBsdf), 
glass_weight*fresnel);
                                                                MicrofacetExtra 
*extra = (MicrofacetExtra*)closure_alloc_extra(sd, sizeof(MicrofacetExtra));
 
@@ -375,7 +375,7 @@ ccl_device void svm_node_closure_bsdf(KernelGlobals *kg, 
ShaderData *sd, float *
                                                                        /* 
setup bsdf */
                                                                        
ccl_fetch(sd, flag) |= bsdf_microfacet_ggx_fresnel_setup(bsdf);
                                                                }
-                                                       }
+                                                       //}
                                                }
 
                                                /* refraction */

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to