Explaining the Scratch Off algorithm of the Hatching brush

JL VT pentalis at gmail.com
Sat Jun 19 17:44:54 CEST 2010


My original aim with the brush was giving artists a tool to make boring(tm),
very regular hatching directly with a tool instead of having to use
time-consuming filters. With time I've been thinking of also allowing the
user to do a more "organic" hatching too (
http://bmia.bmt.tue.nl/Research/MVIAV/IVR/ivrsb/index.php?Page=Hatching ;
check the middle skull), but that would take long, I'd surely have to
sacrifice not finishing a halftone brush to work on that. I think it's worth
the attempt though.

Now, with respect to "boring, very regular" hatching, the current algorithm
(described in the GUI as trigonometry-algebra) has the problem that lines
thicken in incremental mode (opaque background off) and look jagged in wash
(opaque background on). Part of the jagging comes from the fact that the
tips in the borders of the lines look different than the inner parts, so
cutting those borders would help; that would have the extra benefit of
reducing thickening in incremental mode. But even so, the lines get
inherently out of sync when drawn little-chunk by little-chunk instead of
all at a time; I am sure that it is due to the rasterization step, because I
did the algebra carefully, and floating-point calculations aren't THAT
imprecise to cause such errors to arise (or are they?).

The solution was to make that new algorithm, which would work as follows
(the tooltip should explain this to the user): when the brush begins to
paint, create an invisible canvas the size of the current selection, and
hatch it; the brush will then "uncover" that invisible area as it paints,
just like a scratch off card.

Now, if the user is using a pressure sensitive device (tablet), many
invisible canvases (or "layers") will be created, one for each different
setting caused by the differing pressure (for example, each invisible canvas
would use a different thickness). Then, when the user paints, the respective
'layer' with the right settings will be "uncovered" and painted to the
actual (visible) canvas.
I expect this to have the following disadvantages: slow during
initialization, as it must hatch many big invisible surfaces.
Advantages: quick after initialization, no jagging of the borders in wash
mode, less thickening of the lines in incremental mode (they would only
darken, not get out-of-synch adding extra pixels of thickness).

I believe the "no jagging and less thickening" benefit is remarkable, it
would make the hatching generated look almost as clean if it were made by a
filter, but it would be generated in real time and directly on the canvas by
the user, instead of requiring the user to mount an elaborate set of layers
and apply filters on it to get his final result (besides, the GIMP's
Newsprint filter isn't too versatile with the hatching, so it would take the
user many iterations and therefore a great deal of time to achieve areas
with different thickness or with crosshatching, using that filter).



Endnote: with respect to Incremental and Wash: the dialogue the UI offers
for choosing between incremental and wash mode has different effects than
what I envisioned as the "opaque background" option, that's why I want both
to coexist. When I link the BrushTip dialogue I'll make a proof of concept.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.kde.org/pipermail/kimageshop/attachments/20100619/0e9239fb/attachment.htm 


More information about the kimageshop mailing list