Suppose you make the two lines as in your last video, with the gaps on the top side of each one, and then you want to fill the outside area by clicking on the bottom side of the image. How would that detect the gaps by just casting rays? Also, how do you close the gaps, just by drawing a line?
With gap detection set to a medium size tolerance (top example), it should fill the gaps that are below (or equal to) this tolerance, so the small and medium ones.
With detection set to small (bottom example), all larger gaps remain open and only the smaller one is filled.
And finally, with a large gap detection setting, the fill tool should only fill the left square.
The small detection is useful to only correct lines that failed to touch each other, whereas larger gaps remain open. You can see that having such a threshold will allow you to fill multiple regions at once depending on the threshold chosen. Thus saving a lot of time in the process as well. Ideally, the setting would be a pixel based input (integer), so you can set it to 20px, 51px or even 127px.
By the way, what are the plans for a gap detection in the colourise mask tool?
Good question. At the moment the heuristic works by restarting the raycasting recursively at the edges of the āunexplored areasā. So with many recursions, it can work around a circle from the outside. But the recursion depth could be a tool setting because it may starts filling too agressively.
It closes the gaps because the rays in the gap didnāt hit anything behind them. If thereās an object behind the gap, it will hit the wall behind it like in the next screenshot, but it will not leak out.
When the object is further away It will not try to leak out because it knows that the rays next to the gap are rather short and limitās the raycasting distance.
What youāre describing is definitely possible. Since the algorithm āknowsā all the gaps, it could measure the gap length and just behave as if the āuser clicked in the gap againā if it has the desired length.
I donāt think raytracing is a good Idea for the colorize mask tool. The colorize tool already works well for gaps (at least for me) and has a more constant time behavior, the larger the image, the slower it is.
I wanted to give some development update:
In the video below the regular ābucket fill toolā (like we have now in Krita) is used to fill Mega Manās face and it leaks through the gap in the eye.
Then I use the new āgap-awareā-fill tool first to fill out the eye and then use the bucket fill as usual to fill the face.
(red lines appearing in the green area show the segmentation)
I know Tahoma2D, an opensource animation software has option to close gaps (although I donāt remember if it can work in raster layers). Perhaps that would be of some use to develop it for Krita?
Also, is there someone doing nightly builds of Krita for Windows so I can test/try out any upcoming features that are in development (I donāt mind crashes, I save often)?
I suggest that you get the portable .zip package. That will not affect your current installation and will use the same configuration settings and resources.
@ramskulls
Fuzzy and textured lineart is still on my to do list. For fuzzy line art, it should work with a threshold similar to the existing bucket fill tool.
This is actually quite simple to implement and we need that anyways if we want to fill anything with smoother lines than pixel art. At the moment, the test app only fills 100% white, as you can see on the two tiny spots on the shoulder where it isnāt completely white and didnāt get filled.
Now I would be really happy to get some feedback how well the āfill-with-gapsā algorithm works
I noticed that it will divide the space of āSā shape. Is there any space for optimization?
When clicking different positions, the filling effect is different. Sometimes it can be filled at one time, but sometimes it needs to be filled multiple times, and it may leave a vacancy
@TheTwo
Thanks for testing the algorithm!
1.) If you click on āPreferencesā thereās some adjustable parameters. But I hope that weāll able to minimize the number of adjustable parameters when this tool is available in Krita, because it might be too overwhelming for the average user.
2.) You can try to modify the parameters in the preferences and see if it gets better for you. Thereās of course space for optimizations. But sometimes it could be better to let the user click 3 times than press undo 3 times because it filled too much.
3.) Yes, it always uses the position where you clicked to start itās search for lineart. This is different from the implementation from GIMP where (according to the developer) it first analyses the whole image in a background process and then uses that information for the fill-with-gaps tool.
At present, I donāt quite understand the parameters, but I think it is too complicated to fill in structures like hair. In addition, it is always ineffective for lines with large internal space.
@TheTwo
Thank you, both good and bad feedback are very much appreciated!
I took one of my lineart test pictures with hair and filled it with default parameters using my krita feature test app. Itās true that filling complicated structures like hair doesnāt work so well.
Below are the test results for both my testapp and GIMPās lineart fill feature.
I fiddled around with GIMPs sliders for a few minutes, but the result was never what I expected. Maybe somebody mastered it already and can show that it works better than in my short video.
Krita Feature Testapp
GIMP
Update: I just tested GIMPās tool with thick black lines and then it works very well but it also can only fill small areas at a time.
Are there any āscientificā papers on the subject in which researchers present a gap fill algorith? Maybe that could give you some additional clues. Donāt you think there will be bugreports submitted if the tool doesnāt fill the whole region (e.g. the hair) in one go? People are, by now accustomed to that from Photoshop and such. Blender and Illustrator do so too, but they just extend vector lines, which doesnāt seem feasible here. Unless you were to vectorise the outline of the isovist (raytracing) as bezier curves, perhaps?