Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPascal Schoen <pascal_schoen@gmx.net>2016-09-26 13:35:36 +0300
committerPascal Schoen <pascal_schoen@gmx.net>2016-09-26 13:35:36 +0300
commit4d3a0032ecea99031979f342bfd5f66ea5a8625a (patch)
treea0a6906d17092d709fda83c0413e1339593ddcdf /intern/cycles
parent3cd5eb56cf5c9006837f111c8866e4c6e1c2a6fd (diff)
Enhanced performance for Disney materials without subsurface scattering
Diffstat (limited to 'intern/cycles')
-rw-r--r--intern/cycles/kernel/svm/svm_closure.h22
1 files changed, 20 insertions, 2 deletions
diff --git a/intern/cycles/kernel/svm/svm_closure.h b/intern/cycles/kernel/svm/svm_closure.h
index d3ed0bd1982..8aca266f482 100644
--- a/intern/cycles/kernel/svm/svm_closure.h
+++ b/intern/cycles/kernel/svm/svm_closure.h
@@ -149,7 +149,25 @@ ccl_device void svm_node_closure_bsdf(KernelGlobals *kg, ShaderData *sd, float *
if (path_flag & PATH_RAY_DIFFUSE_ANCESTOR)
subsurface = 0.0f;
- if (subsurf_sample_weight > CLOSURE_WEIGHT_CUTOFF) {
+ if (subsurface < CLOSURE_WEIGHT_CUTOFF) {
+ /* diffuse */
+ if (diffuse_weight > CLOSURE_WEIGHT_CUTOFF && fabsf(average(baseColor)) > CLOSURE_WEIGHT_CUTOFF) {
+ float3 diff_weight = weight * diffuse_weight;
+ float diff_sample_weight = fabsf(average(diff_weight));
+
+ DisneyDiffuseBsdf *bsdf = (DisneyDiffuseBsdf*)bsdf_alloc(sd, sizeof(DisneyDiffuseBsdf), diff_weight);
+
+ if (bsdf) {
+ bsdf->N = N;
+ bsdf->baseColor = baseColor;
+ bsdf->roughness = roughness;
+
+ /* setup bsdf */
+ ccl_fetch(sd, flag) |= bsdf_disney_diffuse_setup(bsdf);
+ }
+ }
+ }
+ else if (subsurf_sample_weight > CLOSURE_WEIGHT_CUTOFF) {
/* radius * scale */
float3 radius = make_float3(1.0f, 1.0f, 1.0f) * subsurface;
/* sharpness */
@@ -239,7 +257,7 @@ ccl_device void svm_node_closure_bsdf(KernelGlobals *kg, ShaderData *sd, float *
#ifdef __CAUSTICS_TRICKS__
if (kernel_data.integrator.caustics_reflective || (path_flag & PATH_RAY_DIFFUSE) == 0) {
#endif
- if (specular > CLOSURE_WEIGHT_CUTOFF || metallic > CLOSURE_WEIGHT_CUTOFF) {
+ if (specular_weight > CLOSURE_WEIGHT_CUTOFF && (specular > CLOSURE_WEIGHT_CUTOFF || metallic > CLOSURE_WEIGHT_CUTOFF)) {
float3 spec_weight = weight * specular_weight/* * (specular * (1.0f - metallic) + metallic)*/;
MicrofacetBsdf *bsdf = (MicrofacetBsdf*)bsdf_alloc(sd, sizeof(MicrofacetBsdf), spec_weight);