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
path: root/source
diff options
context:
space:
mode:
authorAlexander Gavrilov <angavrilov@gmail.com>2017-01-04 19:40:34 +0300
committerAlexander Gavrilov <angavrilov@gmail.com>2017-01-04 19:44:29 +0300
commitb86042f21a8d905bea91af7c04b1265b7517f4cf (patch)
tree87148cfc317a1135054c007655c2e8383ffbbe61 /source
parenta9163f7d222d9d4949987c9690f44bdb6e43f163 (diff)
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.
Diffstat (limited to 'source')
-rw-r--r--source/blender/blenkernel/intern/dynamicpaint.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/source/blender/blenkernel/intern/dynamicpaint.c b/source/blender/blenkernel/intern/dynamicpaint.c
index 66070923153..4d9e314afc4 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);
}