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:
authorSergey Sharybin <sergey.vfx@gmail.com>2017-07-18 10:25:58 +0300
committerSergey Sharybin <sergey.vfx@gmail.com>2017-07-18 10:46:21 +0300
commit5f35682f3abf8752f0cc155e7cc209bca4f3f852 (patch)
treec477ba6762c0ef1a2a22b5256a2306db086c5672 /intern/cycles/kernel/kernel_accumulate.h
parentd8906f30d358eb03ff19578298003bb6ca7fa760 (diff)
Fix T52021: Shadow catcher renders wrong when catcher object is behind transparent object
Tweaked the path radiance summing and alpha to accommodate for possible contribution of light by transparent surface bounces happening prior to shadow catcher intersection. This commit will change the way how shadow catcher results looks when was behind semi transparent object, but the old result seemed to be fully wrong: there were big artifacts when alpha-overing the result on some actual footage.
Diffstat (limited to 'intern/cycles/kernel/kernel_accumulate.h')
-rw-r--r--intern/cycles/kernel/kernel_accumulate.h11
1 files changed, 7 insertions, 4 deletions
diff --git a/intern/cycles/kernel/kernel_accumulate.h b/intern/cycles/kernel/kernel_accumulate.h
index 175bd6b9737..9ed16aceb55 100644
--- a/intern/cycles/kernel/kernel_accumulate.h
+++ b/intern/cycles/kernel/kernel_accumulate.h
@@ -220,7 +220,9 @@ ccl_device_inline void path_radiance_init(PathRadiance *L, int use_light_pass)
#ifdef __SHADOW_TRICKS__
L->path_total = make_float3(0.0f, 0.0f, 0.0f);
L->path_total_shaded = make_float3(0.0f, 0.0f, 0.0f);
- L->shadow_color = make_float3(0.0f, 0.0f, 0.0f);
+ L->shadow_background_color = make_float3(0.0f, 0.0f, 0.0f);
+ L->shadow_radiance_sum = make_float3(0.0f, 0.0f, 0.0f);
+ L->shadow_throughput = 0.0f;
#endif
#ifdef __DENOISING_FEATURES__
@@ -680,11 +682,12 @@ ccl_device_inline float3 path_radiance_sum_shadowcatcher(KernelGlobals *kg,
const float shadow = path_radiance_sum_shadow(L);
float3 L_sum;
if(kernel_data.background.transparent) {
- *alpha = 1.0f-shadow;
- L_sum = make_float3(0.0f, 0.0f, 0.0f);
+ *alpha = 1.0f - L->shadow_throughput * shadow;
+ L_sum = L->shadow_radiance_sum;
}
else {
- L_sum = L->shadow_color * shadow;
+ L_sum = L->shadow_background_color * L->shadow_throughput * shadow +
+ L->shadow_radiance_sum;
}
return L_sum;
}