Bug 363364

Summary: Spacing is inconsistent when controlled by speed
Product: krita Reporter: Chris Jones <chrjs>
Component: Brush enginesAssignee: Krita Bugs <krita-bugs-null>
Status: RESOLVED FIXED    
Severity: normal CC: halla, ramskullsart
Priority: NOR    
Version: 2.9   
Target Milestone: ---   
Platform: Microsoft Windows   
OS: Microsoft Windows   
Latest Commit: Version Fixed In:
Attachments: Spacing glitches
Spacing Speed preset
testing speed parameter on opacity and size
using attached spacing speed preset with longer strokes

Description Chris Jones 2016-05-21 08:43:11 UTC
When speed is used to control spacing, the spacing is erratic every so often.  See following attached image in which all lines were drawn at a roughly consistent speed.  Reproducible on desktop PC and Surface Pro 4

Reproducible: Always

Steps to Reproduce:
1.  Load Spacing Speed B preset (attachment to follow)
2.  Create an image around 2K in size.
3.  Draw a sequence of strokes until one of them breaks up into rectangles, as in the example image.



Note: a useful application for controlling spacing with speed is to optimise presets so that they are smooth when drawing slowly, and fast when drawing broadly (at the expense of smoothness).  The example preset is demonstrative of this particularly at larger scales.  The above issue makes it unusable for this purpose.
Comment 1 Chris Jones 2016-05-21 08:44:48 UTC
Created attachment 99110 [details]
Spacing glitches
Comment 2 Chris Jones 2016-05-21 08:46:11 UTC
Created attachment 99111 [details]
Spacing Speed preset
Comment 3 Halla Rempt 2016-05-21 13:54:14 UTC
Hi Chris,

Thanks for your report. I can confirm the effect. It also happens in 2.9, so it is not a regression.
Comment 4 ramskullsart 2019-08-29 08:07:02 UTC
Created attachment 122409 [details]
testing speed parameter on opacity and size

Hello, I saw this bug and I can reproduce it in 4.2.5. I was about to submit this as a new bug report but I think it could be the same behavior? I've attached a photo of what results I've been getting so far. It doesn't only affect spacing.

The original bug submitted showed short strokes so I thought it would be good additional info to show longer strokes. I hope this helps. I'm on Windows 10 with Huion H640P tablet.
Comment 5 ramskullsart 2019-08-29 08:08:10 UTC
Created attachment 122410 [details]
using attached spacing speed preset with longer strokes
Comment 6 Dmitry Kazakov 2020-09-17 22:46:48 UTC
Git commit 4b7cab76c1cd24bfc98b257648530f221dd94807 by Dmitry Kazakov.
Committed on 17/09/2020 at 22:15.
Pushed by dkazakov into branch 'master'.

Fix speed smoothing algorithm not to generate blobs during the stroke

There were the following problems:

1) KisPaintingInformationBuilder::hover() geneated distance noise
   while the user was painting on screen. Now it doesn't add sample
   points when the stroke is started, only while hovering.

2) KisSpeedSmoother now has longer buffer. 10 samples was too low value
   for tablets emitting events every 7 ms. 512 should be enough for
   everyone!

3) Now there is a minimal smoothing time range. It is set to 15 ms.
Related: bug 375360

M  +5    -2    libs/ui/tool/kis_painting_information_builder.cpp
M  +2    -1    libs/ui/tool/kis_painting_information_builder.h
M  +29   -10   libs/ui/tool/kis_speed_smoother.cpp
M  +2    -0    libs/ui/tool/kis_speed_smoother.h
M  +1    -1    libs/ui/tool/kis_tool_freehand_helper.cpp
M  +1    -1    plugins/tools/tool_transform2/kis_liquify_paint_helper.cpp

https://invent.kde.org/graphics/krita/commit/4b7cab76c1cd24bfc98b257648530f221dd94807
Comment 7 Dmitry Kazakov 2020-09-22 09:15:00 UTC
Git commit 4211646e20c928c0013402cce938f2f0555b3fe7 by Dmitry Kazakov.
Committed on 22/09/2020 at 09:14.
Pushed by dkazakov into branch 'krita/4.3'.

Fix speed smoothing algorithm not to generate blobs during the stroke

There were the following problems:

1) KisPaintingInformationBuilder::hover() geneated distance noise
   while the user was painting on screen. Now it doesn't add sample
   points when the stroke is started, only while hovering.

2) KisSpeedSmoother now has longer buffer. 10 samples was too low value
   for tablets emitting events every 7 ms. 512 should be enough for
   everyone!

3) Now there is a minimal smoothing time range. It is set to 15 ms.
Related: bug 375360

M  +5    -2    libs/ui/tool/kis_painting_information_builder.cpp
M  +2    -1    libs/ui/tool/kis_painting_information_builder.h
M  +29   -10   libs/ui/tool/kis_speed_smoother.cpp
M  +2    -0    libs/ui/tool/kis_speed_smoother.h
M  +1    -1    libs/ui/tool/kis_tool_freehand_helper.cpp
M  +1    -1    plugins/tools/tool_transform2/kis_liquify_paint_helper.cpp

https://invent.kde.org/graphics/krita/commit/4211646e20c928c0013402cce938f2f0555b3fe7