MaLiang icon indicating copy to clipboard operation
MaLiang copied to clipboard

Brush size and opacity?

Open ViaJables opened this issue 4 years ago • 10 comments

Can you tell me if I am doing something wrong in trying to set opacity, or if it is a bug?

The initialization of opacity on the brushes seems to depend on the brush, even though the color is set by taking the current color and applying the opacity (0 to 1) to it. Setting the opacity on a slider I can't seem to get it to change linearly. For example if I go from 0.3 to 0.00005 there isn't a smooth transparency change.

Additionally, brush size seems to affect the appearance of the opacity. On procreate, for example, a large brush and small brush with the same opacity drawn over white would appear the same. That doesn't appear to be the case here.

Thanks for your help. Amazing library.

ViaJables avatar May 24 '20 06:05 ViaJables

@ViaJables Yes, It's a bug. The logic about opacity is a bit messy, I'm trying to resolve this.

Harley-xk avatar May 25 '20 08:05 Harley-xk

I'll buy you two cups of coffee when you do

ViaJables avatar May 25 '20 22:05 ViaJables

@ViaJables try the new 2.8.0 release, different brush sizes will have similar opacity now

Harley-xk avatar May 28 '20 05:05 Harley-xk

This is looking much much better. What should the opacity ranges be?

Try drawing a blue, then choose a darker blue. If you set the opacity low enough (less than 0.3ish) and draw over the first blue it will actually change the color of the underlying blue instead of building up the slightly darker blue like you'd expect. Is that from setting the opacity too low or a side effect of the new math?

ViaJables avatar May 28 '20 07:05 ViaJables

Current solution is simple and not perfect, your situation is one of the side effect. It seems that the low opacity effects the rbg value passing to Metal, I'm not very sure why. Maybe I will need to change some logic from the bottom.

Harley-xk avatar May 28 '20 07:05 Harley-xk

The solution actually works pretty well until you get brush sizes greater than 50. It degenerates completely around 200.

ViaJables avatar Jun 13 '20 01:06 ViaJables

Which I guess means, the opacity of brushes still depends on brush size . . .

ViaJables avatar Jun 13 '20 02:06 ViaJables

Yes, because the difference of brush size will cause the overlapping of textures change, so the actual opacity set to the texture should be calculated from the user specified alpha, the brush size and the point step. This actual opacity value often will be a very small number, and the accuracy will be effected here.

Harley-xk avatar Jun 15 '20 00:06 Harley-xk

Is altering the opacity according to those three variables the solution that you are recommending? I can look into implementing that. Unfortunately, the artists I have testing my app are telling me the current solution isn't suitable for digital drawing as opacity is a foundational tool.

ViaJables avatar Jun 16 '20 19:06 ViaJables

Also you can play with blending modes, I'll try that now

ulitiy avatar Sep 22 '20 03:09 ulitiy