-
Notifications
You must be signed in to change notification settings - Fork 130
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
Erase all pixels on a layer based on their RGB value / draw BEHIND and COLOR ERASE brush modes #191
Comments
Another application that utilizes this blue pencil and black pencil technique is PAP:
Also Here is they have the colorize line command I am suggesting:
I hope this explains it better than my first post.
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 |
Sketching with multiple pencils (black and blue for example) will work great with the tool management system that is already implemented in drawpile. This workflow would also greatly compliment live paintchat sessions and motivate people to use less layers to do complete drawings and make it extremely easy to cleanup drawings. It is not useful only for the animation workflow, which is currently limited to one layer. It adds great value to all user cases in drawpile. |
updated the name of the proposal and some of the last posts so as to make it more clear what it does |
This works just like flood fill's "fill under" mode. Issue #191
I implemented an "underpaint" blend mode, since it is basically the same as the normal mode with just the alpha channels reversed. I tried implementing a color erase mode too, and it kinda works, but not reliably enough for me. The problem is that when you have semi-transparency, mixing arbitrary colors is a destructive process and can't really be reversed. It's only possible with a limited palette of distinct color channels (like black, red, green and blue) Given these limitations, I'm not sure how to work this feature into Drawpile's UI. |
The limited palette would do fine! :) Actually this feature is implemented as a limited palette in all other software that has it. This could be worked out into the ui in two different ways i think. Approach 1
Set sketch brush operation mode to:
The draw behind brush mode for the normal brush is still useful when you want to correct issues with incomplete bucket fills btw. Approach 2 Thank you for the work so far btw! |
approach 1 To explain approach 1. The icon is not great, just took the pen tool icon and added a little something. The commands drop down menu button could take the currently active sketch color as a visual hint. But that is just an idea. Not sure if it would work well in the ui. For approach 2, it would be more complicated to come up with a design I think :) "erase by color" is an extra feature btw, it is not a must have. Just nice to have in some cases, but not that important. |
Here is a line test to investigate if alpha affects it in tvpaint: Please note that drawing semi-transparent lines is not a common user case scenario. If you look at the hand holding a handle example - lines there are crisp - with not much alpha going on in black strokes. We want black strokes to not be affected by blue/green/red strokes bellow them. Honestly having black and blue is enough to get this workflow. |
updated one of the previous posts in order to add a gui mockup for approach 2. Approach 2 would be more flexible I think. Hope this helps :) No other open source has this workflow/feature at the moment. Mypaint could have benefited from it as well. |
Here is a mockup for Approach 3 In this example all of the functionality is inside a simple menu, where each entry has a submenu with the 4 colors. I think its pretty clear what it does that way and it is done without changing the UI too much. Without touching any of the tool settings. Just a clean, simple menu with the commands. The Sketching menu can also be placed inside "tools" if you think its cluttering too much. That is the best i can come up with. :) I hope you like it |
Thanks, lots of good ideas and information! I'm not sure if I can fit this in before the 1.0 release, which I'm hoping to do in a few weeks. I'll probably have to postpone the rest of the implementation until after version 2.0. |
I see. Thank you for the work so far :) Looking forward to the 1.0 release! And even more for 2.0 I've been doing clean up, inbetweens and coloring on a production with tvpaint, and this feature is at the core of the clean up workflow. It's essential |
Actually, now that I think about it, a simple sketch tool (like in your approach 1 mockup) might be possible to implement without any major protocol changes, just by adding two more blending modes: Behind (already done!) and normal paint For sketching. Nothing special here. Color erase This is the tricky bit. A general purpose color erase mode only works well when colors are not mixed (i.e. opacity is always 100%) However, when we limit the palette to red, green and blue, we can just zero out the channel to erase a specific color. I think the alpha channel is calculated by taking the multiplied color value and subtracting it from the current alpha ( a=a-(c*a) ) The colorize pixels action can be implemented as a Recolor mode FillRect. So, if these blending modes work as I think they will, I'll be adding this feature for 1.0 after all! |
This sounds about right. :) To me personally the biggest feature is the clear pixels and colorize pixels commands. Those should work nicely with all the drawing tools in drawpile, for as long as one uses the right colors. As mentioned before, opacity is not that important, as the final ink line is usually solid. But if you manage to get even that to work perfectly, then i guess it will be technically better. Can't wait to try out an implementation and play with it. This is going to be so great |
In the above image, the horizontal lines were drawn first and the vertical lines were drawn after, but with the "Behind" blending mode. It looks like the color eraser isn't quite as simple as I thought. Even thought blending primary colors does not mix the channels, it can still cause the other color channels to darken. I would guess this happens in tvpaint too if you paint semi-transparent blue over black? I noticed that Gimp has a pretty good color erase mode that can work with any color (although in this use case, the palette should still be limited to R/G/B for clean separation). I'll see if I can adapt their blending code. |
In this line test I am replicating your experiment in tvpaint: 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:
It looks like you are really close to getting this working. If the line darkening is solved. |
After looking at gimp's color erase mode - it seems to do the erasure compositing right - just like tvpaint in the experiment! This is what I found: Hope it helps. :) |
I think it works! Thanks for testing with tvpaint. The new color erase mode seems to be equivalent to what it has. I added a button to Eraser settings to toggle between normal mode and color eraser. |
Awesome!! :DD Drawpile is becoming more and more amazing as an animation tool. Thank you for having the patience to read through this thread and for implementing it so quickly. I am happy to have helped. |
Ok, I just tried it and it works like a charm!! I noticed you called the command "color erase selection" and "recolor selection" . This made me try to lasso select a few pixels and see if the commands actually works on a selection. They dont work on a lasso selection yet. |
Great. Yeah, lasso selection doesn't work yet. Rectangular selections are filled with the FillRect command, but non-rectangular ones are sent as bitmaps. The problem is that unlike FillRect, PutImage only supports a few basic blending modes. I'll have to see if I can make it use the same compositing code. I think this feature is now done for version 1.0, unless I've forgotten something? |
PutImage blend modes (and thus, recolor/erase with lasso selections) now work! The extra modes are not yet exposed in the UI, but the protocol now supports all the same modes for images as it does for brushes and layers. |
Awesome work! :) Thank you for these improvements. |
note:
I moved this out of #180 so it is easier to discover and discuss individually.
The request:
Add these layer commands (to the layers menu or as a tool) that can be assigned to shortcuts:
Benefits:
It is a feature that would be beneficial if you are doing animation on single layers #180 and need to clean it up (as you do in most cases).
It would also be beneficial to sketching in general - simplifying the process by eliminating the need to create and use multiple layers in order to clean up your sketch before coloring.
Example in other software:
One way to be able to sketch, clean up and ink a drawing without the need to use multiple layers is to do it like tvpaint -
https://vimeo.com/57043308 (see at 5:28)
It has 4 compositing inks that can be erased individually - red, cyan, green and black.
The user sketches in one color (cyan), then for the second pass sketches with another color(black) over the old color. Then with a single click of a button, he erases the first color that is underneath (cyan) and gets a clean drawing with only the second pass (black).
If he wants to further refine the drawing, the artist turns the cleaned sketch he has (black ink) into a another color (cyan) again - with a single click. Then repeats the process.
This is really a fantastic way to work on a single layer and mimics the traditional animator workflow as well! In traditional animation animators sketch with the cyan pencil, then sketch with the black pencil on top of the cyan. Then erase the cyan pencil with an eraser that only affects it.
I am not sure how hard it would be for you to get a color by it's rgb value on a layer and erase it, or colorize it to another rgb value. Tvpaint has 4 colors to do this workflow, but you can really get away with two - cyan and black.
The text was updated successfully, but these errors were encountered: