![]() Create and add an invisible stroke going between the ending point, pts, and a point extension_distance away along that tangent.Calculate the ending tangent of the stroke: normalize(pts - pts).Create and add an invisible stroke going between the starting point, pts, and a point extension_distance away along that tangent.Calculate the starting tangent of the stroke: normalize(pts - pts). ![]() This algorithm is also fairly straightforward: The idea is that if your stroke didn't quite reach all the way to connect with another stroke, you can invisibly extend it a little bit before filling so that you end up with a closed region. The other method Blender uses involves extending your strokes by a user-specified distance before doing a fill. Unfortunately this is the scenario I found myself in. This means there are cases where, if leak_size is larger than your stroke width, the plus doesn't get stopped by gaps. However, an issue with this design is that it doesn't check the pixels between the center of the plus and its corners. Why two? This lets the plus get right up to some edges that it would otherwise not quite reach. Instead of a single pixel moving around, you've got a little plus shape that will poke itself wherever it will fit, as long as under two of its corners hit an edge. If a horizontal and a vertical corner has been coloured, it will stop. Instead of stopping only if a pixel has been coloured by a stroke, it also checks pixels plus or minus leak_size pixels away in the x and y axes. ![]() This works as long as the region being filled has no gaps in it: it's like you've got a single pixel brush that you move around the drawing, and it can poke itself through any gap through which it can fit.īlender's leak size check adapts this algorithm slightly. Create a new filled shape out of the vectorized the outline of all the filled region pixels.Otherwise, add this pixel to the list of filled pixels, and add any yet-unchecked pixels neighbouring the current one to the queue.If the pixel has been coloured in by a stroke, do nothing.Take the next pixel location out of the queue.Create a queue of pixels to check, starting with the one under the mouse cursor.Create an empty list of pixels that are in the filled region.For context, when you select the fill tool and click somewhere on the canvas, Blender uses a classic flood fill algorithm to discover the shape of the region being filled: The first one I looked at takes place in bitmap space: the leak size parameter. After finding where they live in the codebase, I went through each one, tried to understand them, and tried to see how they might be affecting my drawings. I mentioned that there are two types of automatic gap closing currently in Blender. This is one of the best parts of open source, in my opinion: if something bugs you enough, you can just go in and try to solve it yourself. Probably the former would take less time overall, but I'm allergic to doing tedious, repetitive work, so I'd rather take a risk and do the latter. I had the choice of either suffering through the tedious trial-and-error of testing different gap closing techniques for every frame needing to be coloured, or downloading the Blender source code and trying to improve the tools myself. One can also hold the alt key to draw an invisible line and manually close gaps, but this requires finding the gap that's preventing the fill from working, and it's often not easy to see. Blender comes with two tools for automatic gap closing when filling-leak size and stroke extensions-but neither seemed reliable enough for my drawings. However, when it came to filling in the outlines with colour, I was finding that shapes that looked closed were not getting filled by the fill bucket tool. ![]() (This deal must be pretty compelling it worked on my sister too.) So far so good, five stars out of five! I was having a great time drawing in Blender! I made this little animation about the time I got Maddy to drink pickle brine by promising that I'd drink some too. I'd heard about its Grease Pencil 2D animation environment since 2019 but had never truly tried it for myself. The other week, after learning that my old version of Flash wouldn't ever be able to work on my new M1 Mac, I finally decided to try switching to Blender. This is both for practical financial reasons (this sort of animation is just a hobby, I'd rather not pay a subscription fee), and also because, as a programmer, I just want to support open source projects. I learned on Flash back in the day, and while it's the software I'm the most productive in, I keep looking for reasons to switch to something open source. I still do a little bit of classical 2D animation every once in a while as a hobby. Baby Dave (14 years old?) doing some animation
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |