diff options
author | Sergey Sharybin <sergey@blender.org> | 2021-11-24 19:06:32 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey@blender.org> | 2021-11-25 12:17:52 +0300 |
commit | 726bc3a46b2fcf6ba36c3e3484b344340f83e53e (patch) | |
tree | eb79ca0b9c68971b22ed7a0b1e1afc39d7793568 /intern/cycles/kernel | |
parent | ce5561b815366f714e68bd81fc130afb79c267ef (diff) |
Fix T93155: Approximate shadow catcher displayed wrong on CPU and GPU
Was happening during rendering, causing visual artifacts when doing
CPU+GPU rendering, and giving different in-progress results on different
devices.
The root of the issue comes to the fact that math used in the approximate
shadow catcher calculation might have resulted in negative alpha channel,
and negative values for display are handled differently on CPU and GPU.
Such difference in handling is caused by an approximate conversion used on
the CPU for the performance reasons.
This change makes it so no negative alpha is generated by the approximate
shadow catcher. Not sure if we need some explicit clamping somewhere to
deal with possible negative values coming from somewhere else.
The shadow catcher cornell box tests are to be updated for the new code,
but the new result seems to be more accurate.
Differential Revision: https://developer.blender.org/D13354
Diffstat (limited to 'intern/cycles/kernel')
-rw-r--r-- | intern/cycles/kernel/film/read.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/intern/cycles/kernel/film/read.h b/intern/cycles/kernel/film/read.h index d308a9818e2..18a593a75b1 100644 --- a/intern/cycles/kernel/film/read.h +++ b/intern/cycles/kernel/film/read.h @@ -460,7 +460,7 @@ ccl_device_inline float4 film_calculate_shadow_catcher_matte_with_shadow( const float transparency = in_matte[3] * scale; const float alpha = saturatef(1.0f - transparency); - const float alpha_matte = (1.0f - alpha) * (1.0f - average(shadow_catcher)) + alpha; + const float alpha_matte = (1.0f - alpha) * (1.0f - saturatef(average(shadow_catcher))) + alpha; if (kfilm_convert->use_approximate_shadow_catcher_background) { kernel_assert(kfilm_convert->pass_background != PASS_UNUSED); |