Harmony brush adoption in Krita: Sketch

Besides my sponsored work on Krita, I work in my spare time (if I find some) on some new features. I did a thesis about brush painting and I still enjoy this topic. So when I find some new interesting brush, that might be usable, I’m trying to adopt it in Krita as a new brush engine. Few months ago I discovered project Harmony and I liked the brushes there. Especially Sketchy, Shaded, Chrome, Fur and Long Fur. The idea for those brushes comes from concept of connecting neighbour points. The concept was realized first in Scribbler and Harmony was inspired. Then I adopted the Harmony version in Krita.

Animtim: Using the sketch here

So far it seems to be useful, fun brush. It was already used by artists, especially by Animtim in his first comic page in Krita and also in previous art.

Flower by Sketch

Painted by software developer, with Sketch in Krita

The adoption has some advantages like undo/redo and some different and new features and one drawback.

New features compared to Harmony

Highly configurable

You can create new brushes, because I adopted all five brushes from Harmony as one big brush engine with parameters. I explored the code and came up with names for the parameters, which influence the stroke of the brush. So you can change the size of brush easily. In original Harmony project, the area is just circle with fixed size, that detects the points. In Krita it can be any brush tip (ellipse, flower, chain). I don’t how much is this usable, but at least I found ellipse quite useful compared to circle. Anyway you can create more effects compared to the Harmony version.

For performance reasons you will find in Brush size dialog checkbox called Simple mode, which means that again circle area will be used if check. For the size of the circle, the size of the brush tip you choose in Brush tip is used. What is the performance problem here? Maybe you need some big circle and rasterization of that circle as brush mask is quite slow. On the other hand checking the points in this simple mode in the circle is quite fast no matter of the size.

The main options for the brush are in Brush size option dialog. Let me describe them a little. Line width is new feature compared to Harmony. You can setup the width of the line that is used as connection between the points of the stroke.

Line width in Sketch

Sketch can stroke with different width of the connection lines

Offset scale is partially reverse engineered from Harmony. It influence the size of the connection line between two points. Actually it changes the offset of the start and end point of the connection line. Here I need to work on better UI, because now it is confusing. When you setup the offset to 0% or 100%, it looks same. Weird, right? You can see the demonstration on of it on the next picture.

Offset scaleOffset scale: 60%, 90%, 100%, 200%

Density influence the number of lines. When the brush detects point in the neighbour, it starts to think: Should I make a connection? Hm..let’s look at the density.Ah, density is 100%, why I’m thinking about, of course make a connection. When the density is e.g. 20% the brush think like this: Hm…density is 20%, that means 1 line from 5 detections of neighbour points should be rasterized. Let’s roll the dice. Oh, I can’t make connection – neeeext! There is also related checkbox option called Use distance density. This one uses the distance of the points and dice to decide if to make the connection. It changes the size of the brush due to the way it computes the density of the lines. If you setup 50% density, check the distance density and use the brush tip of size 64, it will usually make connection only for points that are in the distance of 32 pixels and will also roll a dice if it should make a connection. This option is from original Harmony project. I wanted to control the density  just by dice, but I wanted to make presets that mimics the Harmony and I needed this one.

DensityDensity 100%, 20%, 1%

Magnetify option decides whether to connect the current point with points from stroke or to make line with offset right and left and the current mouse position. If the brush is not magnetifying, the effect creates nice fur effect. Tweak the offset scale to get nice effects.

Furry flowersFur effect in Sketch

Random opacity checked causes that in every line has random opacity. This effect was present in Harmony.
Random RGB checked causes that the color of the single line is distorted per channel by random generator. This was needed to support Chrome from Harmony
Distance density checked causes that the connection line will have density according the distance between points that are going to be connected.
Paint connection line checked paints connection line between two positions of the brush always (previous mouse position and current mouse position).

Then I added support for tablet to the Sketch. I implemented it through standard Krita dialogs like Size sensor, Opacity sensor and Rotation sensor. So you can use also different sensors to change the size like fade or for rotation drawing angle. Size sensor changes the size of the area where the detection occurs. Opacity sensor changes the opacity of the dab. In one dab there can be many lines rendered as many points are checked — it is not per line opacity, that’s why there is Random opacity. Rotation sensor rotate the brush tip shape, which is used for detecting the neighbour points. I usually use the ellipse and setup the Rotation sensor to drawing angle. Thanks to the lately added dynamic outlines you can see where it is detecting the points.

UI feedback

You can see the size of the brush on canvas. In Harmony you see just the cursor. I have to improve the situation – somehow the center of the brush is also important. You can switch to showing the cursor instead of the brush outline to temporary workaround it but I plan to add some cross in the middle of the shape.


You can’t undo the stroke in Harmony, you can in Krita 😉

Missing feature compared to Harmony

The detection between the neighbour points occurs only per stroke in Krita’s adoption. In Harmony you can connect to points from previous strokes. I put this problem on the feature list for 2.4 as that is not support in our API yet – to be able to store information about previous strokes somewhere. Brush engine life span takes from the start of the stroke to the end of the stroke. You don’t have information about previous stroke available in the brush engine. Slovak (me) and Russian (Dmitry Medvedev Kazakov) Krita developers will take care of this feature together as it needs to work correctly with undo/redo. Question is if we also want to connect to points only on the same layer or per layer or make it optional. We will find out something.


This brush engine is in experimental state and will be released in Krita 2.3. Experimental brush engine means that the presets you make might not work in Krita 2.4 as the UI will be changed (improved of course) and the brush engine is still under development. I hope to add the missing feature for 2.4 and polish the UI.


There are presets that mimics the Harmony brushes: Sketchy, Shaded, Chrome and Fur (I lost the Long Fur preset, but I will try to fix it). They are installed with Krita, so you can explore them and tweak them as you wish. Preset is the setting of the brush engine saved on the disk if you did not know. The Ribbon brush from Harmony is already in Krita, behaves little differently and it is called Particle brush in Krita. Other brush engines are for me less usable and quite specific so, I do not plan to port them (yet).

Thanks goes to the author of Harmony, Mr. Doob for co-operation. He wrote about Harmony on his blog. Check the Flickr, Google where you find images that can be done with Sketch brush in Krita.

If you create (please, do..) something nice, please, sent it to our gallery at Krita forum.

This entry was posted in Krita. Bookmark the permalink.

7 Responses to Harmony brush adoption in Krita: Sketch

  1. smls says:

    Cool stuff…

    The grid brush on harmony is pretty amazing as well: http://img816.imageshack.us/img816/6814/harmonygrid.png
    (Although I don’t know whether it will have many practical uses… 😉

  2. Ricard says:

    Cool!!! I really like this work. I knew about Scribbler and Harmony and I’m glad this is arriving to Krita.

    I think it would be really awesome to easily script new brushes. Something like a Scripted Brush Engine, where the control widget is basically a text editor with some template code and some functions to fill in (with Python, JavaScript or whatever).

    If it was really easy (no need to compile stuff) would be very happy to add to Krita some drawing procedures I made for a project a while ago (http://www.caligraft.com). Specially the “Dibuixant” (http://www.caligraft.com/exhibition/dibuixant) and the “Sketching” (http://www.caligraft.com/exhibition/sketching) works.

    Keep up the good work!

  3. Are you going to implement some sort of spatial acceleration structure (quad tree?) to speed up adjacency queries in the global (test against all strokes) case? If so, I would be interested to hear about your plans. )

  4. LukasT says:

    If the performance will be ok, then I will avoid that. If the performance will be a problem, then I will start to solve it.
    So far it is just per stroke, so it does not have performance problems. Also harmony does not seems to have many performance problems with just querying every point.

  5. @Ricard I am currently working on something that would allow to create brush engine. It is not with python or javascript, but with a language derives from C and Shaders (so probably very close to Java Script). You can see a few example of this programming language in http://bitbucket.org/opengtl/rijn-collections/src/tip/drawings/ . For now, I am focusing on the drawing generation API, but once it is finished, adding paintop support should be rather easy. Hopefully, it will be available in 2.4, but it depends a bit of how much time I can invest in it :)

  6. UglyMike says:

    Apparently, there’s a Symbian app also incorporating the “connecting neighbour points” brushes.
    I’m always looking for neat Mobile painting apps (iOS, Android or WM) and found this one here: http://www.dtarasov.ru/magicbrush.html

    Totally unrelated, another nice brush can be seen in Android app Penman (Chinese paint – Calligraphy)

  7. Zoran says:

    That’s great Cyrille, will it be possible also to code in brush “behavior” when using tablet (tilt, rotation,…).


Leave a Reply