RSS/Atom feed Twitter
Site is read-only, email is disabled

Brushes/input controllers changes idea

This discussion is connected to the gimp-developer-list.gnome.org mailing list which is provided by the GIMP developers and not related to gimpusers.com.

This is a read-only list on gimpusers.com so this discussion thread is read-only, too.

12 of 13 messages available
Toggle history

Please log in to manage your subscriptions.

Brushes/input controllers changes idea Brian Vanderburg II 06 Jan 09:32
4781A508.6040104@gmail.com 07 Oct 20:26
  Brushes/input controllers changes idea Roland 10 Jan 20:38
   Brushes/input controllers changes idea Alexia Death 10 Jan 20:56
    Brushes/input controllers changes idea David Hodson 11 Jan 00:29
     Brushes/input controllers changes idea Alexia Death 11 Jan 00:51
      Brushes/input controllers changes idea Joern P. Meier 11 Mar 20:46
       Brushes/input controllers changes idea Alexia Death 11 Mar 23:51
        Brushes/input controllers changes idea David Gowers 12 Mar 08:54
         Brushes/input controllers changes idea GSR - FR 12 Mar 19:31
        Brushes/input controllers changes idea Joern P. Meier 14 Mar 16:04
         Brushes/input controllers changes idea David Hodson 15 Mar 05:30
       Brushes/input controllers changes idea Bill Skaggs 12 Mar 17:39
Brian Vanderburg II
2008-01-06 09:32:57 UTC (over 17 years ago)

Brushes/input controllers changes idea

This is an idea that I think would be very nice to have in GIMP. It would probably take a bit of programming, and I can't do that unfortunately.

Definitions: I'm not sure of the proper terms, so I will define what I mean:

Controller - A source of data that is used to modify an attribute of the brush
Attribute - Part of the data for a brush, such as size, color, opacity, angle, etc, etc. Can be modified by a controller.

Problems: The current control-to-attribute has few features and does not offer a great deal of control to the user. It only supports one control and a few attributes. Additionally, for the attributes, there is no specification for how much the attribute is affected. What I mean is, in the toolbox you can check to have the pressure affect the opacity, but not by any given range.

Each attribute connected to a control should have some parameters. Three important ones are start-adjustment, end-adjustment, and adjustment-type.

adjustment-type can be 'absolute', 'relative', or 'percent', and start-adjustment/end-adjustment would the the absolute, relative, or percentage of adjustment caused to the selected attribute based on the value of the controller.

If adjustment-type is 'relative', adjustment-start is '-10', adjustment-end is '10', the selected attribute is brush-size, and the brush size is currently 76, then the controller would cause the brush to go from 66 to 86. if the controller value at the time the data is sampled is 0, then it would be 66, if the controller value is 1, it would be 86.

If adjustment-type is 'absolute', adjustment-start is '50', adjustment-end is '75', the selected attribute is brush-size, and the brush size is currently 76 (that does not matter since it is absolute), then the controller would cause the brush to go from 50 to 75. if the controller value at the time the data is sampled is 0, then it would be 50, if the controller value is 1, it would be 75

If the adjustment-type is 'percent', then it is relative but by percentage. If adjustment-start is '50% (0.5)', adjustment-end is '150% (1.5)', the selected attribute is brush-size, and the brush size is currently 76, then the controller would cause the brush to go from 38 to 114. if the controller value at the time the data is sampled is 0, then it would be 38, if the controller value is 1, it would be 114

adjustment-start can also be larger than adjustment-end, to cause the opposite affect. For example, to have the opacity be higher with a 'soft' pressure than with a 'hard' pressure

Controller-attribute chain: The design could be such that for each controller, the user can select which attribute(s) is modified, and set the parameters, the problem is that one controller can only be connected the attributes and shares the parameters

GUI:
[Checkbox] - Controller1 Enabled [Checkbox] - Attribute1 affected [Checkbox] - Attribute2 affected ...
[Checkbox] -AttributeN affected ___
[RadioBox]-Adjustment Type
[NumberBox]-Adjustment Start [NumberBox]-Adjustment End

This would allow the user to enable the controller, tell it that the controller affects this attribute and that one, and the parameters. But the parameters are the same for Controller1->Attribute2 and Controller1->Attribute2. It would be desired to have separate parameters for different controller->attribute links. For example, pressure may vary opacity by a certain amount, but size by an even greater amount, for this to be, they can't share parameters.

A controller-attribute chain is really just a list of what controller affects what attribute, and parameters for that specific item:

struct ControllerAttributeSomethingOrAnother {
int controllerSource;
int targetAttribute;
AdjustmentType type;
double start;
double end;
}

When a given brush is applied, each item in the chain would be applied to the 'original' brush attributes, modifying it by some manor:

BrushAttributes b = GetCurrentBrushAttributes();

foreach item in chain {
// interpolate the controller value with the start/end range // so that controller value 0 represents the start value and controller value 1 represents the end value double control_value = GetControllerValue(item.controllerSource) * (item.end - item.start) + item.start; double value;

switch(item.type) {
case 'absolute'
value = control_value;
break;
case 'relative'
value = control_value +
b.GetAttributeValue(item.targetAttribute); break;
case 'percent'
value = control_value * b.GetAttributeValue(item.targetAttribute); break;
}

b.SetAttributeValue(item.targetAttribute, value); }

It would also be possible for the same attribute to be affected by two different controllers. Order does matter for such things, such as Pressure->Opacity percent 0%-100%
Direction->Opacity relative -0.2-0.2 Inital opacity: 75% (0.75)
Pressure controller: 0.75
Direction controller: 0.75

Results: 1. opacity becomes 56% (0.5625) from Pressure->Opacity 2. opacity becomes 66% (0.6625) from Direction->Opacity

Results if order is switched: 1. opacity becomes 85% (0.85) from Direction->Opacity 2. opacity becomes 63% (0.6375) from Pressure->Opacity

Additional types of controllers and attributes: I also think it would be nice if there were some additional controllers and additional attributes:

Controllers: pressure - Same as usual, represents the pressure, only specialized devices can use it (tablets)
tilt - Again only special devices can support it rotation - Not the same as 'direction' below, but some devices can detect the rotation of the pen on the tablet, or so I've heard direction - Based on sampling the position of two points, determine the direction of the line from the first point to the second point speed - Determine timing between the sampling of two points noise - A random source from 0 to 1. This can allow the 'jitter' option to be applied to other things, such as jitter the color or size as well.
Note that a 'noise' controller is different than a 'jitter' attribute It allows an attribute to be 'randomly' changed. It can even be connected to the 'jitter' attribute to allow the jitter radius to be random.

Attributes: opacity
size
color
hue
saturation
lightness
gradient - When using a gradient for a stroke, normally it is based on the movement of distance. This would allow a controller to select what part of the gradient to use. The valid range would be from 0 (start of gradient) to 1 (end of gradient). The initial value of this attribute would be computed as normal (distance into the stroke and the length), and adjustment types would still work, absolute specifying an exact position, and relative/percent specifying a position offset from where it is 'supposed' to be in the gradient angle - One useful combination would be to connect a 'direction' controller to the 'angle' attribute, so it seems that the brush is rotating with the stroke. This means that 'direction' and 'angle' would need to be in the same orientation, either both clockwise or both counter clockwise.
jitter - The position of the applied stroke. Default value is 0 (draw where the cursor is), but it can be adjusted by by a controller if desired. For example, a light pressure can draw directly at the given position and a hard pressure can increase the jitter radius.

GUI interface: A new dialog would exist which would allow the creation of the controller-attribute chain. Some features would thus be removed from the toolbox. It may still be desired to have a separate 'chain' per tool, similar to how the settings of one tool can be difference from the other tool, and when selecting the first tool, it will restore it settings like blend mode/etc. It may be desirable to implement separate chains per tool, so when the user selects one tool, it's chain is used, and when selecting another tool, it's chain is reloaded and used.

This new dialog would consist of a list-like control that is by default empty, with a +/- button to add a new item to the chain. Pressing '+' would insert a new item with default values, '-' would remove the selected item, also maybe a '*' to clone the current item.

Attached is a small mock-up of an idea for the interface. It shows 3 items in the list chain.

*Pressure will adjust the opacity by the current value from 0 to 100 percent. If the brush opacity is 75%, then it will vary from 0 to 75% based on the pressure.
*Pressure will adjust the size by the current value from -20 to 50. If the brush size is currently 45, it will vary from 20 to 95 based on the pressure
*Direction will adjust the angle by an absolute value from 0 to 1. (0 to 360 degrees of direction will adjust the angle of the brush from 0 to 360 degrees). Since it is absolute, the current brush angle is disregarded. If it was relative, it would be added to the current brush angle. More often, relative would probably be the desired setting and not absolute, as the initial 'angle' for the brush may be properly set. Also, how this would work for bitmap brushes would be unclear, (the bitmap would be rotated, and may loose quality), but if it was a vector brush, it would probably work fine as rotation would not cause bad quality..

Again this is just an idea that I think would be useful and would love to see in a future version. The code shown is just the idea for operation, I don't know much about the actual GIMP code.

Changes:

Another idea proposed by David Gowers is to use a tree-based approach instead of a list based approach. Each top-level item in the tree would represent the 'target' attribute, and items in the tree represent the 'source' controller and parameters:

Opacity: Pressure [absolute: 0 to 100%]
Direction [relative: -0.2 to 0.2] Etc:
Etc
Etc
...

Absolute items for any given destination attribute would be moved to the top automatically. During processing of each attribute based on input controllers, encountering an absolute attribute would stop processing, after since it should set the value absolutely instead of relative to the current value.

Brian Vanderburg II

Roland
2008-01-10 20:38:34 UTC (over 17 years ago)

Brushes/input controllers changes idea

Hi Brian Vanderburg II

Maybe you are thinking about something like Mypaint ==>**ee-staff.ethz.ch/~mrenold/mypaint (put http:// instead of **) I advice you to try it. It's better if you have a graphic tablet.

Happy New Year!

Roland (wildhostile).

Alexia Death
2008-01-10 20:56:16 UTC (over 17 years ago)

Brushes/input controllers changes idea

I joined the list so recently that I hadn't seen the proposal from Brian Vanderburg II, now I looked it up from the archives. The patch that I made addresses basics what is desired as "attributes". He offers and interesting concepts for dynamic adjustments GUI. That and the rest falls into what part 2 of my proposal encompassed, an overhaul to paint-core I believe.

David Hodson
2008-01-11 00:29:17 UTC (over 17 years ago)

Brushes/input controllers changes idea

I wrote a proposal to enhance the gimp brush code quite a few years ago, which can still be found here:

http://members.ozemail.com.au/~hodsond/gimpbrush.html

You might want to see if it contains any useful ideas.

Alexia Death
2008-01-11 00:51:59 UTC (over 17 years ago)

Brushes/input controllers changes idea

On Friday 11 January 2008 01:29:17 David Hodson wrote:

I wrote a proposal to enhance the gimp brush code quite a few years ago, which can still be found here:

http://members.ozemail.com.au/~hodsond/gimpbrush.html

You might want to see if it contains any useful ideas.

Ive read it:) Thanks. It does contain some interesting concepts like having unified rendering code and a filter stack.

Best, Alexia

Joern P. Meier
2008-03-11 20:46:41 UTC (about 17 years ago)

Brushes/input controllers changes idea

Alexia Death schrieb:

On Friday 11 January 2008 01:29:17 David Hodson wrote:

I wrote a proposal to enhance the gimp brush code quite a few years ago, which can still be found here:

http://members.ozemail.com.au/~hodsond/gimpbrush.html

You might want to see if it contains any useful ideas.

Ive read it:) Thanks. It does contain some interesting concepts like having unified rendering code and a filter stack.

I agree. :) I have been looking at the GIMP code recently to look for possibilities of implementing some features that could make GIMP more useful for artists that create paintings from scratch (which includes me ;)). A more powerful and flexible brush engine would be near the top of the list.

This would likely also cover the SVG brushes (very appealing idea) and adjustable input curves proposals.

Maybe someone with more insight into the code could give an outline of how it currently works? I am willing to invest some time studying the code myself, but unfortunately it is very scarcely documented and so I am not sure how the various components interact.

Also it would be nice to know if there are already more concrete plans for this (GEGL stuff?), or even if someone is already working on it.

Cheers,

Jörn

Alexia Death
2008-03-11 23:51:36 UTC (about 17 years ago)

Brushes/input controllers changes idea

On Tuesday 11 March 2008 21:46:41 Joern P. Meier wrote:

I have been looking at the GIMP code recently to look for possibilities of implementing some features that could make GIMP more useful for artists that create paintings from scratch (which includes me ;)).

Yay! Another art buff interested in brushes.

A more powerful and flexible brush engine would be near the top of the list.

So true.

This would likely also cover the SVG brushes (very appealing idea) and adjustable input curves proposals.

And dynamics,,, That's important too IMHO. Ability to bind any brush property to one or more motion dynamics, primary or derived (speed, tilt,pressure, angular speed, etc...) .

Maybe someone with more insight into the code could give an outline of how it currently works?
I am willing to invest some time studying the code myself, but unfortunately it is very scarcely documented and so I am not sure how the various components interact.

Gimp is large code wise. I opted for trying to understand the bits I'm working on and not the whole thing at once ;)

I have been hacking in the event side of things since early this year and I'm slowly starting to get a clue how things relate to each other. Perhaps best for you to learn is to trace events stating from display shell callbacks to the drawing code in various tools to get the overview you need?

As I understand it now paint core handles most of painting related stuff, different brush types are dervates of GimpBrush that overload the functions in witch thy differ. Making a new brush type should not be that difficult, but integrating it to UI... That part is a mystery to me.

Also it would be nice to know if there are already more concrete plans for this (GEGL stuff?), or even if someone is already working on it.

Somebody is working on some gegl stuff but its not really usable yet as far as painting goes.

David Gowers
2008-03-12 08:54:16 UTC (about 17 years ago)

Brushes/input controllers changes idea

On Wed, Mar 12, 2008 at 9:21 AM, Alexia Death wrote:

On Tuesday 11 March 2008 21:46:41 Joern P. Meier wrote: > I have been looking at the GIMP code recently to look for > possibilities of implementing some features that could make GIMP more > useful for artists that create paintings from scratch (which includes me > ;)).
Yay! Another art buff interested in brushes.

> A more powerful and flexible brush engine would be near the top of > the list.
So true.

> This would likely also cover the SVG brushes (very appealing idea) and > adjustable input curves proposals. And dynamics,,, That's important too IMHO. Ability to bind any brush property to one or more motion dynamics, primary or derived (speed, tilt,pressure, angular speed, etc...) .

Angular speed? Do you mean 'turning speed', otherwise known as torque?

Maybe someone with more insight into the code could give an outline of

> how it currently works?
> I am willing to invest some time studying the > code myself, but unfortunately it is very scarcely documented and so I > am not sure how the various components interact. Gimp is large code wise. I opted for trying to understand the bits I'm working on and not the whole thing at once ;)

I have been hacking in the event side of things since early this year and I'm slowly starting to get a clue how things relate to each other. Perhaps best for you to learn is to trace events stating from display shell callbacks to the drawing code in various tools to get the overview you need?

As I understand it now paint core handles most of painting related stuff, different brush types are dervates of GimpBrush that overload the functions in witch thy differ. Making a new brush type should not be that difficult, but integrating it to UI... That part is a mystery to me.

The UI is a mystery because no one has worked it out yet. The current design, with two places to control brush behaviour (brushes dialog, and brush editor)
is clearly unsatisfactory. The design seen in mypaint is capable, and it uses up far too much space.
Personally, I envision a GUI like

[target selector] list | this
of | source's
sources | parameters
[add] [remove]

(keeping in mind that it would be very helpful for the dialog to be small enough to be a dockable.

for example, the first item in Brian's first mockup would show like this

[Opacity] Pressure % | CURVE
| HERE

The second would show up like [Size]
Pressure -+ | CURVE
| HERE [1]

and the last would show up like

[Angle] Direction =| CURVE
| HERE [1]

Doubleclicking on an item in the list of sources ought to allow it to be changed to another kind (different source, or different kind of modification).
There should be a quick way to set a single constant value for the curve. shift+click?
There should also be a quick way to enable or disable a particular adjustment

Such a dockable should include targets such as

size opacity
hardness
color from FG/BG (need way to specify opacity for color mix) color from gradient (see above)
dissolve (yes, this sets a percentage of the pixels to transparent, just like dissolve does. I used this once in Pixia and found it a very useful fundamental adjustment)
jitter (replacing the jitter options from paint tool options) rate/exposure (note: ignored for tools that have neither) airbrush pressure (note: airbrush normally inverts the size adjustment. how to account for this?) torque (as suggested by you, Alexia. Well, torque is the technically correct term, however none of the candidates, including 'torque', are very meaningful to a casual inspection.. the final name might be something different again.)

and sources such as time (need some way to set length) -- this would allow you to do 'fade' in a more flexible way.
speed
tilt (note: this is a hardware-provided value, from eg. Wacom Intuos tablets) angle
pressure

This still leaves the matter of VBR editing and later, SVG brush editing. I think we could put them in an expander underneath the main part, in recognition of the fact that they are going to be accessed less often. We also need to ensure that only the things that really are specific to individual brush types go there. eg aspect ratio, rotation, hardness are things that make sense in context of any brush, not only VBRs or SVG.

Oh yes, the UI separation of brush types.. IIRC it's more or less a hack (VBRs are the only editable type, and editing a brush brings up a VBR editor)

When I get my system fully working again, I plan to prototype various UI possibilities in this area using PyGTK, and post the source+screenshots. A UI spec would be helpful, and probably not very possible until there is some UI to try.

Also it would be nice to know if there are already more concrete plans

> for this (GEGL stuff?), or even if someone is already working on it. Somebody is working on some gegl stuff but its not really usable yet as far as painting goes.

Yes. At this point, it would be possible to implement eg. brush rotation using GEGL ops. That would be getting ahead of ourselves, I just want to point out that it is currently possible to do -- and would even be relatively simple.

Bill Skaggs
2008-03-12 17:39:59 UTC (about 17 years ago)

Brushes/input controllers changes idea

Joern P. Meier wrote:

Maybe someone with more insight into the code could give an outline of how it currently works? I am willing to invest some time studying the code myself, but unfortunately it is very scarcely documented and so I am not sure how the various components interact.

That isn't easy. I suggest, very strongly, that you start by picking a single, relatively simple, type of change you would like to make, instead of thinking in general terms. This will make it possible to point you to the relevant parts of the code, and perhaps even to describe how those parts work. Once you have learned from this experience, it will be much easier to go on to other things.

(You could perhaps suggest two or three changes you are interested in, and we could tell you which of them might be best to start with.)

-- Bill

GSR - FR
2008-03-12 19:31:08 UTC (about 17 years ago)

Brushes/input controllers changes idea

Hi,
00ai99@gmail.com (2008-03-12 at 1824.16 +1030):

The UI is a mystery because no one has worked it out yet. The current design, with two places to control brush behaviour (brushes dialog, and brush editor)
is clearly unsatisfactory. The design seen in mypaint is capable, and it uses up far too much space.

2+1, if the brush is hose kind (.gih), you have another control place (and very well "hidden", to the point of making those brushes rather tiresome or "mere experimental toys").

GSR

Joern P. Meier
2008-03-14 16:04:43 UTC (about 17 years ago)

Brushes/input controllers changes idea

Alexia Death wrote:

Gimp is large code wise. I opted for trying to understand the bits I'm working on and not the whole thing at once ;)

That would only be the ultimate goal, of course. ;)

I have been hacking in the event side of things since early this year and I'm slowly starting to get a clue how things relate to each other. Perhaps best for you to learn is to trace events stating from display shell callbacks to the drawing code in various tools to get the overview you need?

Thanks for the hint, I will try this approach. :)

As I understand it now paint core handles most of painting related stuff, different brush types are dervates of GimpBrush that overload the functions in witch thy differ. Making a new brush type should not be that difficult, but integrating it to UI... That part is a mystery to me.

Maybe adding a new brush type wouldn't be difficult, but actually implementing a component based "brush synthesizer" (to use David Hodson's ARP 2500 analogy ;)) might be.

The problem with a selection of hardcoded brush types seems to be that artists cannot really be creative with creating brushes since they would have to be developers at the same time.

Where hard coding is required in the brush engine, it should be done using dynamically loadable modules (or plug-ins, if you will).

The real power of such a system would come from combining the predefined components in ways the developers had never thought of, which means not just twisting knobs on predefined brushes, but also pushing the components around on a filter stack and being able to configure which parameters are affected by the filter (much like in David's proposal).

But I do understand that this would be quite a huge task (especially with a GUI to match).

David Gowers schrieb:

On Wed, Mar 12, 2008 at 9:21 AM, Alexia Death

And dynamics,,, That's important too IMHO. Ability to bind any brush property to one or more motion dynamics, primary or derived (speed, tilt,pressure,angular speed, etc...) .

Angular speed? Do you mean 'turning speed', otherwise known as torque?

Angular speed actually is the correct term ;) (torque is what causes angular acceleration). The angular speed would be obtained by approximating the motion of the brush with a circular curve and calculating the change of angle along this segment per time unit. It actually would be a data source to be mapped, rather than a target.

Bill Skaggs wrote:

That isn't easy. I suggest, very strongly, that you start by picking a single, relatively simple, type of change you would like to make, instead of thinking in general terms. This will make it possible to point you to the relevant parts of the code, and perhaps even to describe how those parts work. Once you have learned from this experience, it will be much easier to go on to other things.

You are right of course. But it is difficult to suggest even simple changes without having a good general understanding of the code (I am just referring to the brush right now and how the chain progresses from the actual input to the brush image appearing on the canvas).

Anyway, I think I am progressing, slowly, with a general idea of how things work. I am currently trying to figure out:

1) How to add a new tool (say, my own hardcoded brush) including widgets for setting options to the UI. The ChangeLog suggests that bits of code have to be added all over the place (gimp-tools.c, gimp-paint.c for the tool, where the UI gets added I have currently no idea).

2) What changes in the state if a new tool is selected.

3) How the tool is invoked. I think I have a general idea, that is, the button_press/motion/button_release events get passed down from the gimp_display_shell to tool_manager, to the active tool (brush,_tool, which is a paint_tool in this case), to the paint_core, to the brush core (paintbrush in this case).

4) How the brush gets applied to the canvas. Right now I think a mask is obtained from whatever brush is selected and this is then pasted to the canvas using the various options.

Souichi TAKASHIGE schrieb:

I'm recently working on developing new PaintBrush extension framework. It's on early development stage, but I'd like to get comments about the framework.

I would be happy to play around with it, if it can be applied to a current version of GIMP. :)

I do not quite understand what the blend brush actually does, but it looks cool. ;)

Cheers,

Joern

David Hodson
2008-03-15 05:30:21 UTC (about 17 years ago)

Brushes/input controllers changes idea

Joern P. Meier wrote:

Maybe adding a new brush type wouldn't be difficult, but actually implementing a component based "brush synthesizer" (to use David Hodson's ARP 2500 analogy ;)) might be. [...]
The real power of such a system would come from combining the predefined components in ways the developers had never thought of, which means not just twisting knobs on predefined brushes, but also pushing the components around on a filter stack and being able to configure which parameters are affected by the filter (much like in David's proposal).

But I do understand that this would be quite a huge task (especially with a GUI to match).

That's right, and that's pretty much where I got stalled and ran out of free time to work on it. The first step would be to demonstrate the power of the approach by duplicating (then replacing) all the existing brush types, using fixed filter stacks and fixed control attachments. Then add code to read and write the stack configuration, and it would be easy to add a whole set of fancy brush types just by thinking up new arrangements of filter stacks - you would want these anyway (in libraries, like patterns or gradients), for artists who didn't want to go behind the scenes. You could write a lot of useful code before needing to tackle the editing GUI.