Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"color erase" and "behind" brush blend modes, colorize to and erase by color all pixels on a layer command #17

Open
blurymind opened this issue Jun 25, 2015 · 4 comments

Comments

@blurymind
Copy link

gimp has those implemented and they are great!!

https://www.youtube.com/watch?v=ixfK0qCEmbg
This would be very useful for cleaning up sketch drawings. Tvpaint and PAP use this feature in order to allow the user to draw with multiple colored brushes. So if using a blue brush for a rough pass, then draw with a black brush on top to ink it and then erase the blue brush lines bellow.

It would be nice to have it in mypaint.

User case example :
To illustrate this, lets say we have a hand and need to draw a new variation of it. We will start with the previous drawing, but erase the parts that need to be changed:
screenshot_2015-06-10_11-42-00

Then we use the blue pencil to sketch a drawing of the new hand variation:
screenshot_2015-06-10_11-43-30
The blue pencil is set to NOT affect existing pixels by drawing on top of them.

We finish the blue line sketch, then we do the opposite, we set a black pencil and set it to overwrite already existing pixels with its color and ink with it:
screenshot_2015-06-10_11-59-55

Finally, we execute the "erase all color on a layer" command, with color set to blue! What we are left with is the clean line art:
screenshot_2015-06-10_12-01-48

All done on a single layer!

You can also apply this to selective eraser mode, where the eraser tool can be set to work only on lines that have the same color as the one that is currently set to the eraser tool.

Why else is this useful?

  • When you draw for animation, and in general - it is good practice to draw an object complete, when the object is behind another object and then erase the part of the line that is behind the other object. In this case we have the fingers of the hand covering the handle. We must draw the entire handle, then clean up the part that is behind the fingers.

The draw behind brush blend mode will be very useful for fixing errors left by bad bucket fill results. Filling areas that it missed, without disrupting the ink lines.

The color erase brush blend mode will be useful for erasing color spills without disrupting the lineart. Or erasing parts of lineart without disrupting fills.

@blurymind
Copy link
Author

Another application that utilizes this blue pencil and black pencil technique is PAP:
http://animationpaper.com/tutorials/
(see lesson 4 and lesson 8)

When you are happy with the rough sketching you can switch to drawing black [F6]. Now refine your sketchy blue drawings by drawing on top of everything in black. Details you left out before, like facial features, arms, hair etc - can be put in now.

Once you have finished refining, you can get rid of the old blue lines with the Clear Blue function - leaving only the new black lines. (The Clear Blue icon is normally placed in userwindow 2 [F2]).
screenshot_2015-04-28_00-15-42

Also Here is they have the colorize line command I am suggesting:

After removing all blue lines, you click and hold the Black to Blue icon - select "All" in the option menu. Now all your new black lines are converted to blue, and you have your detailed animation ready for cleanup.

I hope this explains it better than my first post.
Its basically two commands:

  • erase all lines on the layer that are blue (rough sketching color)
  • colorize all lines on the layer to blue

But in my suggestion I am wondering if it can be done in any color. So Instead of blue, the command could use the current color's RGB values and use the palette to have predefined defaults for a rough sketch color and an inking color.

Here you can download and try applications that have this feature:

To further see how it is designed there

@blurymind
Copy link
Author

here is tvpaint with this feature in action!!

https://youtu.be/leDwFkGLjgs

For the experiment I draw a black line normally- on top and also draw it with "behind" in order to illustrate ontop vs behind.

As you can see tvpaint is successful at two things:

when a semi transparent black line is on top of a blue/red/green line and the blue/red/green line is wiped - the black line's opacity is not affected at all. If however blue/red/green is on top of the black line and is then wiped, the black line's opacity gets affected
When you tell tvpaint to wipe a colored line, it really wipes it. If it overlaps with another colored line in a different color, it does not affect the color of the other line when its wiped where they overlap - just its alpha. In your example for some reason the color changes to black where one color overlaps another color and a wipe occurs.

@0ion9
Copy link

0ion9 commented Jun 26, 2015

I've analyzed this feature in TVP before. I concluded:

  • it works by analyzing the proportion of R/G/B in each pixel, classifying pixels as red, green, blue, or black.
  • Of course we can set all lines to x,y or z color (whatever color we want), that's basically what alpha preservation brush mode does.
  • But we can't cleanly erase just any color. If you experiment with the 'color to alpha' filter in GIMP, it shows the problems that can arise in this case with very similar colors or low opacity drawing. In my estimate, this is why TVP chose to stick to the extremely coarse 'red' 'green' 'blue', 'black' categorization; in the standard RGB image representation, they are mathematically very distinct.
  • We can set all solid pixels to red, green, blue, or black.
  • We can erase (mostly or completely cleanly) those red, green, blue, black categories.
  • I think that the red, green, blue categories have special treatment when erasing : specifically, darker-appearing pixels are considered as containing some black, and therefore the color is extracted -- an operation very similar to GIMP's 'color to alpha' in that it must estimate how much red/green/blue there was, remove it all (setting the pixel color to black if that was the only hue present) and adjust the opacity accordingly.

Other comments:

  • Behind mode is definitely an important complement to alpha-preserve mode.

In your example for some reason the color changes to black where one color overlaps another color and a wipe occurs.

.. In whose example?

@blurymind
Copy link
Author

Ah yes, I copied this from my proposal at drawpile's github. The author implemented this feature by taking the blending mode part of the code from gimp's "color erase".
drawpile/Drawpile#191
After testing it, it works just as well as tvpaint's.
It is now available in drawpile's latest github. Perhaps you can take a look at his implementation and also at the discussion. It might be of help.

@blurymind blurymind changed the title "color erase" and "behind" brush blend modes "color erase" and "behind" brush blend modes, colorize to and erase by color all pixels on a layer command Jun 26, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

3 participants