[Bf-blender-cvs] [b86042f] master: Dynamic Paint: Fix random pixel flooding by absolute brush with spread.

Alexander Gavrilov noreply at git.blender.org
Wed Jan 4 17:45:07 CET 2017


Commit: b86042f21a8d905bea91af7c04b1265b7517f4cf
Author: Alexander Gavrilov
Date:   Wed Jan 4 19:40:34 2017 +0300
Branches: master
https://developer.blender.org/rBb86042f21a8d905bea91af7c04b1265b7517f4cf

Dynamic Paint: Fix random pixel flooding by absolute brush with spread.

If a very low wetness absolute alpha brush is used with spread and
drying effects enabled, some pixels will rapidly accumulate paint.
This happens because paint drying code applies a minimal wetness
threshold that causes the paint to instantly dry out.

Specifically, every frame the brush adds paint at the specified
absolute alpha and wetness set to the minimal threshold, spread
drops it below threshold, and finally drying moves all paint to
the dry layer. This drastically accelerates the rate of flow of
paint into the affected pixels.

Fortunately, the reason paint spread actually ends up decreasing
wetness turns out to be a simple floating point precision problem,
which can be easily fixed by restructuring the affected expression.

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

M	source/blender/blenkernel/intern/dynamicpaint.c

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

diff --git a/source/blender/blenkernel/intern/dynamicpaint.c b/source/blender/blenkernel/intern/dynamicpaint.c
index 6607092..4d9e314 100644
--- a/source/blender/blenkernel/intern/dynamicpaint.c
+++ b/source/blender/blenkernel/intern/dynamicpaint.c
@@ -4737,7 +4737,7 @@ static void dynamic_paint_effect_spread_cb(void *userdata, const int index)
 		CLAMP(w_factor, 0.0f, 1.0f);
 
 		/* mix new wetness and color */
-		pPoint->wetness = (1.0f - w_factor) * pPoint->wetness + w_factor * pPoint_prev->wetness;
+		pPoint->wetness = pPoint->wetness + w_factor * (pPoint_prev->wetness - pPoint->wetness);
 		pPoint->e_color[3] = mixColors(pPoint->e_color, pPoint->e_color[3],
 		                               pPoint_prev->e_color, pPoint_prev->e_color[3], w_factor);
 	}




More information about the Bf-blender-cvs mailing list