diff options
author | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2019-03-22 16:05:18 +0300 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2019-03-22 16:25:28 +0300 |
commit | b0c40de5ee9a31bef0ff9e0b1fa0fd09b0372fd3 (patch) | |
tree | 74eb143b5fc1fed2531d942681af08fb5c214d0c /intern/cycles/kernel/filter | |
parent | 0b98b7ed57864969020275fb096a2007c71f5115 (diff) |
Fix/workaround some types of black dots in denoising with bright speculars.
This is not a real solution and colored dots still remain, just rejecting some
pixels that seem clearly wrong.
Diffstat (limited to 'intern/cycles/kernel/filter')
-rw-r--r-- | intern/cycles/kernel/filter/filter_reconstruction.h | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/intern/cycles/kernel/filter/filter_reconstruction.h b/intern/cycles/kernel/filter/filter_reconstruction.h index 31a7487c77a..ceda8f71f98 100644 --- a/intern/cycles/kernel/filter/filter_reconstruction.h +++ b/intern/cycles/kernel/filter/filter_reconstruction.h @@ -95,14 +95,16 @@ ccl_device_inline void kernel_filter_finalize(int x, int y, } /* The weighted average of pixel colors (essentially, the NLM-filtered image). - * In case the solution of the linear model fails due to numerical issues, - * fall back to this value. */ + * In case the solution of the linear model fails due to numerical issues or + * returns non-sensical negative values, fall back to this value. */ float3 mean_color = XtWY[0]/XtWX[0]; math_trimatrix_vec3_solve(XtWX, XtWY, (*rank)+1, stride); float3 final_color = XtWY[0]; - if(!isfinite3_safe(final_color)) { + if(!isfinite3_safe(final_color) || + (final_color.x < -0.01f || final_color.y < -0.01f || final_color.z < -0.01f)) + { final_color = mean_color; } |