[Bf-blender-cvs] [b0c40de5ee9] master: Fix/workaround some types of black dots in denoising with bright speculars.

Brecht Van Lommel noreply at git.blender.org
Fri Mar 22 14:26:58 CET 2019


Commit: b0c40de5ee9a31bef0ff9e0b1fa0fd09b0372fd3
Author: Brecht Van Lommel
Date:   Fri Mar 22 14:05:18 2019 +0100
Branches: master
https://developer.blender.org/rBb0c40de5ee9a31bef0ff9e0b1fa0fd09b0372fd3

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.

===================================================================

M	intern/cycles/kernel/filter/filter_reconstruction.h

===================================================================

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;
 	}



More information about the Bf-blender-cvs mailing list