Wednesday 15 April 2015

graphics - Need line drawing algorithm for simulating natural pencil -



graphics - Need line drawing algorithm for simulating natural pencil -

i'm writing drawing programme uses pressure level sensitive table input. i'd able simulate soft pencil effect many other fine art programs have (such paint tool sai, fine art rage). technique i'm using @ moment functional, missing cleanness see in more professional programs.

my algorithm @ moment works this:

create bitmap representing head of brush. transparent bitmap black circle drawn on it. circle has inner radius solid black , outer radius. blackness linearly fades opaque transparent move inner outer radius. capture input events tablet. each point contains (x, y) coordinate pressure level value every point after first one, draw line previous point current one. done drawing (daubing) brush bitmap several times between 2 points. step size between each daub chosen there overlap between subsequent daubs.

this works reasonably well, result line blobby , jagged.

one thing need somehow smooth out input points stroke whole smooth. the other thing need figure out how 'drag' brush head along path create stroke. if spacing far apart, stroke looks line of circles. if close together, stroke builds on , becomes dark. (i tried prepare attenuating brush spacing. create things more consistent, stops stroke beingness opaque).

anyhow, i'd expect there's lot of research done on this, if knew look. please allow me know if there improve pencil drawing algorithms out there.

instead of drawing new circle on has been drawn, using standard blending functions (so regions of overlap higher opacity), need maintain maximum opacity far.

only after have built finish stroke (as on white sheet), can blend existing line art.

the image illustrates difference between blending , keeping maximum opacity.

algorithm graphics line

No comments:

Post a Comment