Mask brush flow bug when layer blending mode is burn

When the main brush tip size is larger than the sub brush tip size and the blending mode is burn, serious jagged strokes will appear

But when subtract, there is no sawtooth, so I think it may be a bug

I’ve also noticed that and that’s why initially I didn’t include burn in the new brush texture modes, because it looks kind of ugly.
But I have to say that is not a bug, it’s just how the formula works, which is different than subtract.

Long explanation for the jagged effect:

The formula for burn is 1 - clamp((1 - dst) / src) (src is the masking brush and dst is the dab).
The problem with that is that in the areas outside the masking brush src is 0, which gives a division by 0 in the formula. For that reason a denominator equal to 0 is treated as an infinitelly small number instead, so that a defined value can result.
Then there are two cases:

  1. When dst is less than 1 the numerator (1 - dst) is a number greater than 0 so the division should give an infinitelly large number approaching infinity (as the denominator is treated always as a smaller number). Then that number is clamped to the range [0, 1] which gives 1 and subtracted from 1 in the formula, which gives always 0 as a result.
  2. When dst equals 1 then the numerator becomes 0. So the division gives 0 (remember that we are treating the denominator as an infinitelly small number when it equals 0, so no undefined 0/0 is possible). Then, following the formula, that 0 is clamped to the range [0, 1] which gives 0 again and subtracted from 1 which gives 1.

So the conclussion is that in the fully transparent areas of the masking brush the alpha becomes binarized: fully transparent when the dab is fully or partially transparent and fully opaque when the dab is fully opaque.


Thank you for your reply! I discovered this when I transplanted Photoshop brush to krita brush.

I don’t know if krita’s traffic settings don’t work properly at this time. Can we achieve this brush effect in krita? Thank you!

This is the ABR file of the brush.!AnAzUBTiYPn7r33KqY7CbBcFgM4r?e=1lDcXy

You can try playing with the flow in the normal brush tip and the making brush.
Edit: Well I see you kind of did. I don’t have any other suggestion at this moment.

Yes, I’ve tried. I’ve transplanted some photoshop brushes before. I feel that maybe in this case, krita’s flow doesn’t work correctly.

Some points:

  1. You can not assume that if something works different than Photoshop it is broken. Krita paint engines work differently from Photoshop ones in many aspects.
  2. In your images it seems that you are using textures in the PS screenshot but not in the Krita one. That can change the look of a brush drastically.
  3. You should really show all the pages in the brush dialog to be able to see all the options in the 2 cases.
1 Like

It looks like krita renders color burn dual/mask brushes a little differently than photoshop. I tried to recreate it in Krtia too. The dual brush/mask brush this brush uses is just a 1px round brush. These examples both use no textures

1 Like

Hello, I did some tests again, and I found that there seems to be a bug in the flow effect of krita in this case.

Thank you! I got the same result. The flow effect of photoshop is different from that of krita in this case. In krita, the flow effect seems to disappear.

1 Like

Maybe Photoshop is using a custom color burn like it does in the texturing hard mix mode because, as I explained in the first post, the result should be binary in the outside areas of the masking brush.

Or maybe the operations are performed in a different order. I don’t know, I’m not familiar with that part of the code yet.

Maybe the second case, because they have the same effect when the flow is 100%, but when the flow is less than 100%, the effect of krita is different from that of photoshop, thank you!

@urzeye can you share the brush tip as a png?

Hello, this is the main brush tip, and the sub brush is a soft brush with one pixel.


Hello, I just downloaded the latest beta version of krita 5.0, I found that the effect of the main brush seems to have completely disappeared:

I have done some experiments and made new discoveries:

I used layer blending mode to simulate the blending of brushes, and found that the blending result of brushes is the same as that when the white background is turned on, but the correct result should be that when the white background is turned off.

There’s a recent bug fix related to color dodge/burn, so maybe that’s it.

You can not apply the blend modes like that. You should try this setup:

  1. put masking brush layer on top of main brush layer
  2. put both layers in a group
  3. set the blend mode in the masking brush layer

That’s similar to how the brush texture is applied.
But even then, in the layers the blend is applied to the color, not the alpha. To correctly mimic the brush you should use black layers without alpha and with the brush marks in white.

The behavior is explained in my first post. When using burn, every pixel of the brush outside the mask becomes transparent unless it is fully opaque.
Clearly Photoshop is doing something extra beyond plain color burn blending, but I don’t know what.

Well, thank you. I just feel that burn in photoshop brush is similar to the effect of layer blending after turning off the white background. Sorry.

Just noticed it should look as before in this case, I forgot to change 1 thing when refactoring. Thanks for trying. It should look as before in the next nightly builds.