Archive for the ‘Computer graphics’ Category

New brush in Krita: Softbrush

Monday, March 22nd, 2010

I’m quite busy right these days. I don’t have much time to blog about some nice stuff I have done in Krita in my “spare-thesis time”. I’m writing the thesis about brush engines I implemented for Krita and I wanted to have a brush that is very common among digital painters. I noticed that they heavily uses the basic Pixel brush. I decided I want to have some special pixel brush.

I stared to change the function that produce the brush mask and affects it’s softness. I selected Gaussian as it is nice function and I experiment with this function, but I found it complicated to control it (you setup sigma, uh what is sigma, you artist ask?). So let’s add some different function to the brush mask code. Oh, let’s put this decision to the artists hands, let’s give him some curve he can model as he want. We already has nice widget for that in Krita, so use it. So you can setup the brush mask by curve!

Default CurveSetup brush softness with the curve

On the picture you can see Curve and Gaussian. The top red point represents the value of the brush mask in the center of the brush mask and the red point down in the right bottom corner represents the value of the edge of the brush mask. So far the brush mask supports only elliptical shape but I have also plans for rectangular shape of the brush mask but I need to find a way how to extend the 24-hours limit of the day so that I can code it :) You can add as many control points as you wish and tweak the softness between the center and edges.

You noticed the Gaussian also there, the mode and it’s code works but it will need some more love in the future. It gives some nice results also sometimes. I will see how it will end up.

So let’s make crazy setting of the curve and you can end up with the brush mask like this one with interesting edges:

Funny maskStroke with custom curve to change brush mask

As you can see, the brush supports pressure with no problems. Thanks to the Cyrille’s sensors you can change size by various attributes of your tablet or you can use some silk ones like a time or a distance. The brush supports also a rotation so you can setup some ellipse shape of the brush with a diameter and an aspect ratio and do some funny stuff like this one:

Rotation Dynamics of the soft brush in action

You setup an angle for your shape and you can allow Krita to manage the rotation for you. As you noticed, the opacity has been changing also, yes, you can control opacity with pressure. Those attributes are present in Pixel brush in Krita also. Let’s go for some new one.

I added parameter density to brush so that you can simulate in some non-photorealistic way brushes like charcoal, chalk and crayon. Basically you setup how many pixels from the brush mask will be used in a single dab.  Very nice attribute, I managed to simulate a little charcoal drawing, here is my “developer” painting:

Softbrush, charcoal attemptSoftbrush density demo: Lukáš Tvrdý – House with charcoal

When you paint, your hand can shake. Maybe your hand is very stiff, and you don’t shake with your hand when you paint :D . So I added a parameter for you. It is called Jitter movement. You can setup how much the brush will be jittered when you paint. Maybe want to draw straight lines with shaky feeling. This is example of some mild jittering:

JitteringSoftbrush mild jittering

If you exaggerate the parameter, you can end up with the result that spray brush, my other brush,  do for you

Spraying with jitterSoftbrush crazy jittering

Last feature, that is a little experimental, is called a HSV dynamics. I suppose you know what is HSV, it is physical color model, which model the color in terms of tint – hue, saturation and intensity – value. It was invented for artists so that they can more powerfully control the color they want to choose. I decided to change the parameters of the color dynamically in a stroke. This is still WIP (work-in-process) but so far you are able to grow the parameter, shrink and control it by pressure. Here is some demo, the feature with pressure can produce images with more gradients easily and you can avoid pick-that-color-and-put-it-here problem a little bit:

HSV DemoSoftbrush: Hue growing, saturation shrinking and value growing

You can control the progression by a curve again and more control over the HSV can be done by using pressure option and using the tablet. These features are for 2.2. For 2.3 I already have some new feature and it is called mirroring and it was inspired by David Revoy video tutorial. He is using something very similar in video (link to 4:40).

You define the vertical axis with the softbrush with CTRL+LEFT click and then you paint in mirror mode. If you setup the axis outside the canvas, it is turned off.

As you paint, your brush mask is mirrored and then painted in the mirror mode. It is WIP also, we plan to make it more general so that every brush engine can use it. I get the idea as I was working on canvas mirroring.

I produced video, watch it here in action.

I plan to blog about other new achievements but again time is issue. Beside I work on Krita full-time, I write thesis so I don’t have time these days. If you want to help me, you can produce some art with my brush engines and then I can include your work in my thesis! I’m interested in pictures created with spray, softbrush, sumi-e (will be renamed to hairy brush), deform brush and particle brush and its combination. Some of the pictures you see here are already part of my thesis. You need to compile trunk for it but it is easy!

So far enkithan and n-pigeon provided a lot of nice paintings for me. I pick up the picture that n-pigeon did lately with just soft brush and spray brush.

Softbrush and spray brush: n-pigeon - Watercolor Softbrush & spraybrush: n-pigeon – Watercolor

Krita: Everybody can make a painting

Sunday, November 1st, 2009

I decided to share some GUI between our brush engines (paintops in Krita jargon). I started with color dialog. The color dialog is work-in-process. I co-operate with Cyrille Berger so that more paintops can benefit from color trasformations and also I want to add features that Cyrille coded. First implementers of the color dialog are spray and grid brush.

Color dialog

So I implement some features that are available with grid brush to spray. And now you can do fun stuff. You can be artist with just few clicks. Everybody can make a painting :)

There is painting style called pointillism. If you want to know what is that, wikipedia has nice article and nice picture in neo-impressionism article. Inspiration came also from Paul Haeberli, who did really great job in area of non-photorealistic rendering (Paint By Numbers article). There is Paul’s applet where you can be impressionist (pointillism style also possible with proper settings).

Now in spray brush in Krita you select particle type circle, you check in color dialog, that you want color per particle and sample input color. Then you just go through image and paint where you want. You can get the same result as in picture I did. Don’t forget to load some cool photo which colors will be sampled.

Pointillism

Pointillism with spray brush in Krita

You can select different particle type to get different style. E.g. I selected rectangle with 1px width and 60px height size (lines ;)   and checked random size and same options in the color dialog. I also checked random opacity and random HSV and used sliders to post-process sampled colors as I paint.

ImpressionistKrita-impressionism with spray

So far it is destructive editing, so you paint on photo in the layer. For future you will be able to select layer in which your photo is loaded so that it is not destroyed.

I love to paint clouds :) I always wanted to be able to paint clouds with my brush engines and now I’m closer to that aim. Here is what I get with spray and color dialog:

Clouds

Let’s describe random HSV and opacity a little. Random opacity select random opacity of the color. Easy. Random HSV turn on hue, saturation and value transformation of the color. The sliders in the color dialog sets how much and how far the color can be transformated. If you select from HSV e.g. value to zero, color’s value will not be changed. If you select value 100, then color’s value will be randomly adjusted to interval 0..100. Applies for the hue and saturation in the same manner. You have to understand the HSV model for this usage.

For the clouds I selected white color and checked random opacity and HSV and dragged the value slider to negative values to get darker colors. And I played with gray colors and saturation. Working on thesis is fun! ;)

Interesting blogposts about Flash 10

Monday, October 27th, 2008

I discovered nice blogposts about Flash 10. Some could be inspiration for Krita. I like this version of histogram and I like articles about various blurring effects and there is nice one about linear blur.