[Testing needed] New Colorsmudge Engine for Krita 5.0

Hi!

I’m happy to announce that the new colorsmudge engine that I have been working on for the last several months is now ready for the final testing! :slight_smile:

The original work has been started by @voronwe13, but in the end I had to rewrite the entire engine to incorporate these changes fully.

What’s new:

  1. RGBA-brush mode for the colorsmudge engine. You can now use Lightness brush tip mode in the colorsmudge engine to emulate oil-paint. The brush will do both, smear the background and paint with the impasto-looking stroke.

  2. Colorsmudge engine is now using SSE4 and AVX2 optimizations, so it became almost twice(!) faster. The optimization also applies to old brushes using the old smudge algorithm.

  3. Colorsmudge engine now has the new smudge algorithm developer by @voronwe13. It separates effect of the Color Rate and Smudge Rate options (previously, low values of Smudge Rate affected Color Rate significantly). See this wishlist and KA-thread.

  4. Smudge Radius algorithm is fixed and hugely optimized. In all the versions of Krita released after 2016, the smudge radius value was divided by 100. That is, when you selected 100%, the real value was 1% sampling. The new version fixes the issue.

  5. When using new smudge algorithm and dulling mode, smudge radius now can handle the problem of “pierced” brushes gracefully, which makes brush strokes in “dulling” mode much more smooth, especially when using textured brush tips. See this wishreport and this bug

  6. As a side-effect, the overlay mode has changed its behavior a little bit (even when using the old algorithm). Now the effect is more “correct”, that it, the painting will look almost exactly as if you painted on the merged image.

  7. Just a warning: overlay mode is not available in “Lightness” brush tip mode (and will never be). The checkbox is not yet disabled when you select “Lightness” mode, that is a bug.

Testing Packages

  1. DK4 (16.04.2021)
  2. DK5 (19.04.2021) (cancelled due to a regression)
    • Win64: [deleted]
    • AppImage (with debug, slow): [deleted]
    • AppImage (no debug, fast): [deleted]
  3. DK6 (19.04.2021)
  4. DK7 (20.04.2021)
  5. DK8 (27.04.2021)

So now it is ready for testing and I would be happy to hear your feedback! :slight_smile:

PS:
Here is the thread where @RamonM tested one of the first testing packages with the feature:

25 Likes

:grinning:

That’s awesome!

You are awesome!

Have a virtual beer… :beer:

2 Likes

Alright, I have already been testing this.

  1. I really like the new algorithm, it’s far easier to configure and I am hoping to update my old painting pack to it.
  2. I am occasionally having an assert: ASSERT: "d" in file /home/appimage/persistent/krita/libs/global/kis_shared_ptr.h, line 168, I am unable to tell what causes it, beyond ‘tick new algorithm’.
  3. I am getting weird results with animated brush masks, on brushes where every option is turned off (including sensors on the opacity), except for smudge (turned up 100%, no sensors, dulling, smear alpha, new algorithm) and color-rate (turned up 100%, pressure sensor). with these options, animated masks like ‘rock pitted’ or ‘hearts’ start printing semi-transparent values on lower pressure-values.
1 Like

Cool stuff, good work! :metal: :bearded_person:

The performance is really good, even on my Pentium laptop. That’s awesome!

Since I have some minor issue with smudge brush, even in stable release, I’m wondering if I could post it here or just start a new thread.

The smudge brush will pick the color outside the selected area, like the screenshot below.


Edit:the buttom one is New algorithm + smear alpha off

If your issue is not related to this change you can create a new topic.

Okay, thank you.
I will start a new topic.

Is it safe to test the 5.0 appimage alongside the current stable, or do I need to backup and restore the folders when switching?

backup your folder still, :slight_smile:

1 Like

That was quick! :slight_smile:

Is that just a precaution or do I need to restore the folders when going back to the 4.4.3?

I think the main problem right now is that we handle resources very differently in 5.0, amongst which that we now put all resources, even the bundled ones, into the local resource folder. But this creates a little confusion when switching back and forth between 5.0 and 4.4, as that one will then have duplicate resources.

1 Like

Okay - thanks for clarifying!

While I’m asking about backups; Is there another folder I should be backing up other than the resources? I always lose my settings when I do a fresh OS install, so I assume the config files are located elsewhere?

Sorry if that’s a lazy question - I expect it’s all in the manual somewhere… :innocent:

:slight_smile:

1 Like

:grin:

Soooo… the Krita config file is located in…

THE CONFIG FOLDER?!!! :exploding_head:

:sweat_smile:

I mean - I like… totally knew that!.. I was just… uhh… testing that you hadn’t forgotten!.. :grimacing:

2 Likes

……I have been using the next version of 5.0 directly before
There seems to be no other problem except a bunch of “resourceache.sqlite” in the folder. . .

OK, getting a crash when closing an image, every single time. ASAN output isn’t very interesting here.

  =================================================================
  ==3394958==ERROR: AddressSanitizer: new-delete-type-mismatch on 0x606000f798e0 in thread T0:
  object passed to delete has wrong type:
  size of the allocated type:   64 bytes;
  size of the deallocated type: 8 bytes.
    #0 0x7f3f111af192 in operator delete(void*, unsigned long) (/tmp/.mount_krita-MFwctZ/usr/bin/../lib/libasan.so.2+0x9a192)
    #1 0x7f3f03e62c66 in KoInteractionStrategy::~KoInteractionStrategy() (/tmp/.mount_krita-MFwctZ/usr/bin/../lib/libkritaflake.so.17+0x3b8c66)
    #2 0x7f3ed559556e in SelectionInteractionStrategy::~SelectionInteractionStrategy() (/tmp/.mount_krita-MFwctZ/usr/lib/kritaplugins/krita_flaketools.so+0x5356e)
    #3 0x7f3f03e56ea7 in KoInteractionTool::mouseReleaseEvent(KoPointerEvent*) (/tmp/.mount_krita-MFwctZ/usr/bin/../lib/libkritaflake.so.17+0x3acea7)
    #4 0x7f3ed5594530 in DefaultTool::mouseReleaseEvent(KoPointerEvent*) (/tmp/.mount_krita-MFwctZ/usr/lib/kritaplugins/krita_flaketools.so+0x52530)
    #5 0x7f3f03c9c64b in KoToolProxy::mouseReleaseEvent(KoPointerEvent*) (/tmp/.mount_krita-MFwctZ/usr/bin/../lib/libkritaflake.so.17+0x1f264b)
    #6 0x7f3f03c9d6a0 in KoToolProxy::mouseReleaseEvent(QMouseEvent*, QPointF const&) (/tmp/.mount_krita-MFwctZ/usr/bin/../lib/libkritaflake.so.17+0x1f36a0)
    #7 0x7f3f0c2dcdbf  (/tmp/.mount_krita-MFwctZ/usr/bin/../lib/libkritaui.so.17+0x2b65dbf)
    #8 0x7f3f0cbbc6bd  (/tmp/.mount_krita-MFwctZ/usr/bin/../lib/libkritaui.so.17+0x34456bd)
    #9 0x7f3f0cbe2027 in KisShortcutMatcher::tryEndRunningShortcut(Qt::MouseButton, QEvent*) (/tmp/.mount_krita-MFwctZ/usr/bin/../lib/libkritaui.so.17+0x346b027)
    #10 0x7f3f0cbe3ef5 in KisShortcutMatcher::buttonReleased(Qt::MouseButton, QEvent*) (/tmp/.mount_krita-MFwctZ/usr/bin/../lib/libkritaui.so.17+0x346cef5)
    #11 0x7f3f0cb8d265 in KisInputManager::eventFilterImpl(QEvent*) (/tmp/.mount_krita-MFwctZ/usr/bin/../lib/libkritaui.so.17+0x3416265)
    #12 0x7f3f0cb8fa42 in KisInputManager::eventFilter(QObject*, QEvent*) (/tmp/.mount_krita-MFwctZ/usr/bin/../lib/libkritaui.so.17+0x3418a42)
    #13 0x7f3f064a70cc in QCoreApplicationPrivate::sendThroughObjectEventFilters(QObject*, QEvent*) (/tmp/.mount_krita-MFwctZ/usr/bin/../lib/libQt5Core.so.5+0x2850cc)
    #14 0x7f3f06f848b4 in QApplicationPrivate::notify_helper(QObject*, QEvent*) (/tmp/.mount_krita-MFwctZ/usr/bin/../lib/libQt5Widgets.so.5+0x1628b4)
    #15 0x7f3f06f8c35f in QApplication::notify(QObject*, QEvent*) (/tmp/.mount_krita-MFwctZ/usr/bin/../lib/libQt5Widgets.so.5+0x16a35f)
    #16 0x7f3f0cd1e61a in KisApplication::notify(QObject*, QEvent*) (/tmp/.mount_krita-MFwctZ/usr/bin/../lib/libkritaui.so.17+0x35a761a)
    #17 0x7f3f064a7347 in QCoreApplication::notifyInternal2(QObject*, QEvent*) (/tmp/.mount_krita-MFwctZ/usr/bin/../lib/libQt5Core.so.5+0x285347)
    #18 0x7f3f06f8b451 in QApplicationPrivate::sendMouseEvent(QWidget*, QMouseEvent*, QWidget*, QWidget*, QWidget**, QPointer<QWidget>&, bool, bool) (/tmp/.mount_krita-MFwctZ/usr/bin/../lib/libQt5Widgets.so.5+0x169451)
    #19 0x7f3f06fdf179  (/tmp/.mount_krita-MFwctZ/usr/bin/../lib/libQt5Widgets.so.5+0x1bd179)
    #20 0x7f3f06fe20e2  (/tmp/.mount_krita-MFwctZ/usr/bin/../lib/libQt5Widgets.so.5+0x1c00e2)
    #21 0x7f3f06f848db in QApplicationPrivate::notify_helper(QObject*, QEvent*) (/tmp/.mount_krita-MFwctZ/usr/bin/../lib/libQt5Widgets.so.5+0x1628db)
    #22 0x7f3f06f8bfb7 in QApplication::notify(QObject*, QEvent*) (/tmp/.mount_krita-MFwctZ/usr/bin/../lib/libQt5Widgets.so.5+0x169fb7)
    #23 0x7f3f0cd1e61a in KisApplication::notify(QObject*, QEvent*) (/tmp/.mount_krita-MFwctZ/usr/bin/../lib/libkritaui.so.17+0x35a761a)
    #24 0x7f3f064a7347 in QCoreApplication::notifyInternal2(QObject*, QEvent*) (/tmp/.mount_krita-MFwctZ/usr/bin/../lib/libQt5Core.so.5+0x285347)
    #25 0x7f3f06956a96 in QGuiApplicationPrivate::processMouseEvent(QWindowSystemInterfacePrivate::MouseEvent*) (/tmp/.mount_krita-MFwctZ/usr/bin/../lib/libQt5Gui.so.5+0x14ca96)
    #26 0x7f3f06958064 in QGuiApplicationPrivate::processWindowSystemEvent(QWindowSystemInterfacePrivate::WindowSystemEvent*) (/tmp/.mount_krita-MFwctZ/usr/bin/../lib/libQt5Gui.so.5+0x14e064)
    #27 0x7f3f0693433a in QWindowSystemInterface::sendWindowSystemEvents(QFlags<QEventLoop::ProcessEventsFlag>) (/tmp/.mount_krita-MFwctZ/usr/bin/../lib/libQt5Gui.so.5+0x12a33a)
    #28 0x7f3ef634adb9  (/tmp/.mount_krita-MFwctZ/usr/plugins/platforms/../../lib/libQt5XcbQpa.so.5+0x6adb9)
    #29 0x7f3efee63f9c in g_main_context_dispatch (/usr/lib/x86_64-linux-gnu/libglib-2.0.so.0+0x51f9c)
    #30 0x7f3efee6421f  (/usr/lib/x86_64-linux-gnu/libglib-2.0.so.0+0x5221f)
    #31 0x7f3efee642c2 in g_main_context_iteration (/usr/lib/x86_64-linux-gnu/libglib-2.0.so.0+0x522c2)
    #32 0x7f3f0650072e in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) (/tmp/.mount_krita-MFwctZ/usr/bin/../lib/libQt5Core.so.5+0x2de72e)
    #33 0x7f3f064a5609 in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) (/tmp/.mount_krita-MFwctZ/usr/bin/../lib/libQt5Core.so.5+0x283609)
    #34 0x7f3f064ae653 in QCoreApplication::exec() (/tmp/.mount_krita-MFwctZ/usr/bin/../lib/libQt5Core.so.5+0x28c653)
    #35 0x409c86 in main (/tmp/.mount_krita-MFwctZ/usr/bin/krita+0x409c86)
    #36 0x7f3f05e2e0b2 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x270b2)
    #37 0x40be98 in _start (/tmp/.mount_krita-MFwctZ/usr/bin/krita+0x40be98)

0x606000f798e0 is located 0 bytes inside of 64-byte region [0x606000f798e0,0x606000f79920)
allocated by thread T0 here:
    #0 0x7f3f111ae592 in operator new(unsigned long) (/tmp/.mount_krita-MFwctZ/usr/bin/../lib/libasan.so.2+0x99592)
    #1 0x7f3f03e63eb7 in KoShapeRubberSelectStrategy::KoShapeRubberSelectStrategy(KoToolBase*, QPointF const&, bool) (/tmp/.mount_krita-MFwctZ/usr/bin/../lib/libkritaflake.so.17+0x3b9eb7)
    #2 0x7f3ed558abc7 in DefaultTool::createStrategy(KoPointerEvent*) (/tmp/.mount_krita-MFwctZ/usr/lib/kritaplugins/krita_flaketools.so+0x48bc7)
    #3 0x7f3f03e58501 in KoInteractionTool::createStrategyBase(KoPointerEvent*) (/tmp/.mount_krita-MFwctZ/usr/bin/../lib/libkritaflake.so.17+0x3ae501)
    #4 0x7f3f03e58897 in KoInteractionTool::mousePressEvent(KoPointerEvent*) (/tmp/.mount_krita-MFwctZ/usr/bin/../lib/libkritaflake.so.17+0x3ae897)
    #5 0x7f3ed559418a in DefaultTool::mousePressEvent(KoPointerEvent*) (/tmp/.mount_krita-MFwctZ/usr/lib/kritaplugins/krita_flaketools.so+0x5218a)
    #6 0x7f3f03c9d04c in KoToolProxy::mousePressEvent(KoPointerEvent*) (/tmp/.mount_krita-MFwctZ/usr/bin/../lib/libkritaflake.so.17+0x1f304c)
    #7 0x7f3f03c9d3b0 in KoToolProxy::mousePressEvent(QMouseEvent*, QPointF const&) (/tmp/.mount_krita-MFwctZ/usr/bin/../lib/libkritaflake.so.17+0x1f33b0)
    #8 0x7f3f0c2dce6f  (/tmp/.mount_krita-MFwctZ/usr/bin/../lib/libkritaui.so.17+0x2b65e6f)
    #9 0x7f3f0cbbae03  (/tmp/.mount_krita-MFwctZ/usr/bin/../lib/libkritaui.so.17+0x3443e03)
    #10 0x7f3f0cbe4b8c in KisShortcutMatcher::tryRunReadyShortcut(Qt::MouseButton, QEvent*) (/tmp/.mount_krita-MFwctZ/usr/bin/../lib/libkritaui.so.17+0x346db8c)
    #11 0x7f3f0cbe548d in KisShortcutMatcher::buttonPressed(Qt::MouseButton, QEvent*) (/tmp/.mount_krita-MFwctZ/usr/bin/../lib/libkritaui.so.17+0x346e48d)
    #12 0x7f3f0cb8ed01 in KisInputManager::eventFilterImpl(QEvent*) (/tmp/.mount_krita-MFwctZ/usr/bin/../lib/libkritaui.so.17+0x3417d01)
    #13 0x7f3f0cb8fa42 in KisInputManager::eventFilter(QObject*, QEvent*) (/tmp/.mount_krita-MFwctZ/usr/bin/../lib/libkritaui.so.17+0x3418a42)
    #14 0x7f3f064a70cc in QCoreApplicationPrivate::sendThroughObjectEventFilters(QObject*, QEvent*) (/tmp/.mount_krita-MFwctZ/usr/bin/../lib/libQt5Core.so.5+0x2850cc)

SUMMARY: AddressSanitizer: new-delete-type-mismatch ??:0 operator delete(void*, unsigned long)
==3394958==HINT: if you don't care about these warnings you may set ASAN_OPTIONS=new_delete_type_mismatch=0
==3394958==ABORTING
1 Like

I’m going to have my work cut out updating the colorsmudge pages… Here’s an example with 50% color rate, and from left-to-right the values are opacity, smudge length and brush spacing.

Smear old:
image

Smear new:
image

Dull old:
image

Dull new:
image

The new algorithm, as stated, separates color rate from smudge length, and in practice this means that opacity doesn’t feel like it has a quadratic effect on color rate anymore.

I’m still mulling on how to explain this on the color smudge reference page without overwhelming people though.

EDIT:

The lightness map brushes are still very easily capable of smearing to black or white, which confuses me, because I thought there was a lot of work put into changing the strokes system, so self-sampling wouldn’t happen that readily?:
image
Also getting tiar’s problem here.

EDIT2:
Gradient mapped brush-tips also don’t work.

I found out that the lightness map tips work a little as expected when the brush has a color rate, but when there’s no color rate, the crawl-to-black happens, and even with color rate, only the smear mode works as expected, dulling mode doesn’t work with lightness mode somehow? This was doublechecked with the 16-04 appimage.

1 Like

Hi, @wolthera!

OK, getting a crash when closing an image, every single time. ASAN output isn’t very interesting here.

Fixed, though it is not related to my branch, it is some regression from the merged master :slight_smile:

The lightness map brushes are still very easily capable of smearing to black or white

Fixed. I’m sorry, that was an trivial refactoring mistake, I’ve linked the colorsmudge source to a wrong source :slight_smile:

Gradient mapped brush-tips also don’t work

I’ve fixed that as well.

I found out that the lightness map tips work a little as expected when the brush has a color rate, but when there’s no color rate, the crawl-to-black happens, and even with color rate, only the smear mode works as expected, dulling mode doesn’t work with lightness mode somehow?

Should be fixed now.

The only thing I haven’t checked now is the animated brush masks.

4 Likes

My first two tests with the this release krita-5.0.0-prealpha-601167c-x86_64.appimage — Яндекс.Диск


This is comparing the dragging effect. First strokes are with normal smudge brush “wet Bristles rough” and the other brushstroke is with RGBA. I show in parameters the Smudge length and I see Blur instead of Drag.

After that i tested with another brushtip and everything seems better. Why? i need to investigate. @wolthera has given me a hint in IRC channel.
This shows how lightness can be used now and also i have dragging effect. I need to test this more deeply but i think this is a great step forward. The beginning of new era of brushes :heart_eyes:

1 Like