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-08-11 10:33:18 +0300
committerSergey Sharybin <sergey.vfx@gmail.com>2017-08-11 14:49:50 +0300
commitbd069a89aa3a2d166bc7cb4746a2b757497fdddc (patch)
treea16dad6a4c54b6ec2925758448109c0bccc2dae9 /intern/cycles/kernel/kernel_accumulate.h
parent59a52fef6cebac25a296a9c8cc76017bf471f7ee (diff)
Fix T52229: Shadow Catcher artifacts when under transparency
Added some extra tirckery to avoid background being tinted dark with transparent surface. Maybe a bit hacky, but seems to work fine.
Diffstat (limited to 'intern/cycles/kernel/kernel_accumulate.h')
-rw-r--r--intern/cycles/kernel/kernel_accumulate.h19
1 files changed, 11 insertions, 8 deletions
diff --git a/intern/cycles/kernel/kernel_accumulate.h b/intern/cycles/kernel/kernel_accumulate.h
index 9ed16aceb55..d139e28b013 100644
--- a/intern/cycles/kernel/kernel_accumulate.h
+++ b/intern/cycles/kernel/kernel_accumulate.h
@@ -21,6 +21,9 @@ CCL_NAMESPACE_BEGIN
* BSDF evaluation result, split per BSDF type. This is used to accumulate
* render passes separately. */
+ccl_device float3 shader_bsdf_transparency(KernelGlobals *kg,
+ const ShaderData *sd);
+
ccl_device_inline void bsdf_eval_init(BsdfEval *eval, ClosureType type, float3 value, int use_light_pass)
{
#ifdef __PASSES__
@@ -223,6 +226,7 @@ ccl_device_inline void path_radiance_init(PathRadiance *L, int use_light_pass)
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;
+ L->shadow_transparency = 1.0f;
#endif
#ifdef __DENOISING_FEATURES__
@@ -398,10 +402,11 @@ ccl_device_inline void path_radiance_accum_total_light(
#endif
}
-ccl_device_inline void path_radiance_accum_background(PathRadiance *L,
- ccl_addr_space PathState *state,
- float3 throughput,
- float3 value)
+ccl_device_inline void path_radiance_accum_background(
+ PathRadiance *L,
+ ccl_addr_space PathState *state,
+ float3 throughput,
+ float3 value)
{
#ifdef __PASSES__
if(L->use_light_pass) {
@@ -421,9 +426,7 @@ ccl_device_inline void path_radiance_accum_background(PathRadiance *L,
#ifdef __SHADOW_TRICKS__
if(state->flag & PATH_RAY_STORE_SHADOW_INFO) {
L->path_total += throughput * value;
- if(state->flag & PATH_RAY_SHADOW_CATCHER_ONLY) {
- L->path_total_shaded += throughput * value;
- }
+ L->path_total_shaded += throughput * value * L->shadow_transparency;
}
#endif
@@ -671,7 +674,7 @@ ccl_device_inline float path_radiance_sum_shadow(const PathRadiance *L)
if(path_total != 0.0f) {
return path_total_shaded / path_total;
}
- return 1.0f;
+ return L->shadow_transparency;
}
/* Calculate final light sum and transparency for shadow catcher object. */