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:
authorBrecht Van Lommel <brechtvanlommel@gmail.com>2018-01-27 00:11:28 +0300
committerBrecht Van Lommel <brechtvanlommel@gmail.com>2018-01-27 01:06:53 +0300
commit7b29e917118ffdeb39de5c942dd652d40914dbc3 (patch)
tree55b5f0cc45cf07ef2cc72d26b8ca9f4fa7c07b8c /intern/cycles/kernel/svm/svm_closure.h
parentd611cf9233583a04b9168850ddbf708236de44b3 (diff)
Code refactor: make mixed small/large BSSRDF radii more robust.
Diffstat (limited to 'intern/cycles/kernel/svm/svm_closure.h')
-rw-r--r--intern/cycles/kernel/svm/svm_closure.h64
1 files changed, 21 insertions, 43 deletions
diff --git a/intern/cycles/kernel/svm/svm_closure.h b/intern/cycles/kernel/svm/svm_closure.h
index b2fc01f617e..5a5cf2db401 100644
--- a/intern/cycles/kernel/svm/svm_closure.h
+++ b/intern/cycles/kernel/svm/svm_closure.h
@@ -153,7 +153,6 @@ ccl_device void svm_node_closure_bsdf(KernelGlobals *kg, ShaderData *sd, float *
#ifdef __SUBSURFACE__
float3 mixed_ss_base_color = subsurface_color * subsurface + base_color * (1.0f - subsurface);
float3 subsurf_weight = weight * mixed_ss_base_color * diffuse_weight;
- float subsurf_sample_weight = fabsf(average(subsurf_weight));
/* disable in case of diffuse ancestor, can't see it well then and
* adds considerably noise due to probabilities of continuing path
@@ -182,27 +181,19 @@ ccl_device void svm_node_closure_bsdf(KernelGlobals *kg, ShaderData *sd, float *
sd->flag |= bsdf_principled_diffuse_setup(bsdf);
}
}
- else if(subsurface > CLOSURE_WEIGHT_CUTOFF && subsurf_sample_weight > CLOSURE_WEIGHT_CUTOFF) {
- /* radius * scale */
- float3 radius = subsurface_radius * subsurface;
- /* sharpness */
- float sharpness = 0.0f;
- /* texture color blur */
- float texture_blur = 0.0f;
-
- /* create one closure per color channel */
+ else if(subsurface > CLOSURE_WEIGHT_CUTOFF) {
Bssrdf *bssrdf = bssrdf_alloc(sd, subsurf_weight);
+
if(bssrdf) {
- bssrdf->sample_weight = subsurf_sample_weight * 3.0f;
- bssrdf->radius = radius;
+ bssrdf->radius = subsurface_radius * subsurface;
bssrdf->albedo = subsurface_color;
- bssrdf->texture_blur = texture_blur;
- bssrdf->sharpness = sharpness;
+ bssrdf->texture_blur = 0.0f;
+ bssrdf->sharpness = 0.0f;
bssrdf->N = N;
bssrdf->roughness = roughness;
/* setup bsdf */
- sd->flag |= bssrdf_setup(bssrdf, (ClosureType)CLOSURE_BSSRDF_PRINCIPLED_ID);
+ sd->flag |= bssrdf_setup(sd, bssrdf, (ClosureType)CLOSURE_BSSRDF_PRINCIPLED_ID);
}
}
}
@@ -756,35 +747,22 @@ ccl_device void svm_node_closure_bsdf(KernelGlobals *kg, ShaderData *sd, float *
case CLOSURE_BSSRDF_CUBIC_ID:
case CLOSURE_BSSRDF_GAUSSIAN_ID:
case CLOSURE_BSSRDF_BURLEY_ID: {
- float3 albedo = sd->svm_closure_weight;
float3 weight = sd->svm_closure_weight * mix_weight;
- float sample_weight = fabsf(average(weight));
-
- /* disable in case of diffuse ancestor, can't see it well then and
- * adds considerably noise due to probabilities of continuing path
- * getting lower and lower */
- if(path_flag & PATH_RAY_DIFFUSE_ANCESTOR)
- param1 = 0.0f;
-
- if(sample_weight > CLOSURE_WEIGHT_CUTOFF) {
- /* radius * scale */
- float3 radius = stack_load_float3(stack, data_node.z)*param1;
- /* sharpness */
- float sharpness = stack_load_float(stack, data_node.w);
- /* texture color blur */
- float texture_blur = param2;
-
- /* create one closure per color channel */
- Bssrdf *bssrdf = bssrdf_alloc(sd, weight);
- if(bssrdf) {
- bssrdf->sample_weight = sample_weight * 3.0f;
- bssrdf->radius = radius;
- bssrdf->albedo = albedo;
- bssrdf->texture_blur = texture_blur;
- bssrdf->sharpness = sharpness;
- bssrdf->N = N;
- sd->flag |= bssrdf_setup(bssrdf, (ClosureType)type);
- }
+ Bssrdf *bssrdf = bssrdf_alloc(sd, weight);
+
+ if(bssrdf) {
+ /* disable in case of diffuse ancestor, can't see it well then and
+ * adds considerably noise due to probabilities of continuing path
+ * getting lower and lower */
+ if(path_flag & PATH_RAY_DIFFUSE_ANCESTOR)
+ param1 = 0.0f;
+
+ bssrdf->radius = stack_load_float3(stack, data_node.z)*param1;
+ bssrdf->albedo = sd->svm_closure_weight;
+ bssrdf->texture_blur = param2;
+ bssrdf->sharpness = stack_load_float(stack, data_node.w);
+ bssrdf->N = N;
+ sd->flag |= bssrdf_setup(sd, bssrdf, (ClosureType)type);
}
break;