chsh2 / nijiGPen

An add-on of Blender focusing on Grease Pencil
GNU General Public License v3.0
220 stars 9 forks source link

Smart Fill idea: Use boundary stroke as source, keep same material in output #26

Open Pullusb opened 1 year ago

Pullusb commented 1 year ago

Hello !

I followed the evolution of the tool for some times and the new smart fill is a really cool addition!

I wanted to do the same, but so far only made a slow pixel based prototype (rendering hints and line as pixel > generate the fill areas using Gmic CLI with a krita-like colorize mask > then tracing back to vector in Blender...) Your approach is much nicer and efficient.

I have some enhancement suggestions for the tool.

First the need

Output with existing material

nijiGPen_0_5_1_material_output

I noticed in the output choice you can only create new material or use vertex color output. Those options are interesting, but I think using only current material in stack is more useful in most cases. Whether it's on my personal files or in studio productions, there is usually a crafted material palette we want to keep (sometimes material are even linked, and we want to use those).

The thing is, those are fills material, not stroke type, and it's easier to hint with line (I don't know if you consider the fills differently btw).

First I thought you could plainly duplicate all material "as stroke", with a _line suffix, then smart fill would use related fill material as output. But it's not user-friendly, ends up with a doubled material stack and unsynced with original linked material...

Then the mean

Use boundary strokes as source

I think there is a way more elegant solution and ready-to-use for this use case. Using blender built-in boundary strokes feature!

With bucket fill tool selected, pressing Alt and tracing make a stroke that appears like a line, with same material source and color, the perfect hint.

nofill_boundary_stroke_as_hint_stroke

The Stroke is tagged as nofill_stroke, so they are clearly identified. Meaning they could even be used within the same color layer, thus allowing to combine work, using smart fill then quickly add some finishing touches directly on the color layer ! That could be the default behavior if hint layer field is empty.

A dedicated hint layer is still a nice option, depending on peoples workflow.

And final bonus, there is already a function that would clean those special hints Grease Pencil > cleanups > boundary strokes. So user can get rid of them whenever he wants whatever the source layer.

cleanup_boudary_strokes

Sorry for the long post, but I was excited by this idea and wanted to explain the idea in details :D

Samuel

chsh2 commented 1 year ago

That sounds like a good idea. I do not use boundary strokes myself, so I completely forgot about them. I will try to add this option.

I have one question about boundary strokes. I noticed that they show the stroke color on the screen instead of the fill color. It looks kind of confusing and I wonder how you deal with it. Do you manually set the same color for stroke and fill?

Pullusb commented 1 year ago

Hi, Yes, I usually have same color for fill and stroke, I'm so used to that setup that I forgot this could be different ! :grin:

Probably the biggest flaw in this design, it's always hard to find a compromise. But I think it's not a problem in most cases, and the usefulness far outweighs the problem. In all studio uses I have seen, we always used a single color for both fill and strokes, but I'll ask around to see different opinions.

If user want to have an active and different stroke color on fill materials, it's definitely problematic. But even in this case, it means the user would also want to output the original material, not create a new one as in current implementation. So another method would be needed anyway (probably basic material "_line" duplication).

On the other end, it could also be interesting to purposely set a different color. For example, a slightly more "flashy" variation, so the hint could still be visible above the final color. (Arguably, user just have to tune down the opacity of the Color layer to achieve this. Similar to Krita's colorize mask behavior)

chsh2 commented 1 year ago

Thank you for the explanation. I am glad to know how your studio works as I have little knowledge about collaborative art creation.

I tend to implement this feature as 3 separate options:

  1. The ability for the algorithm to use the fill color as long as the hint stroke has it. (Currently it always uses the line color.)
  2. A new option to get the materials from hint strokes.
  3. A new option to use boundary strokes as hint strokes. If checked, only 2 input layers are needed instead of 3.

I think this will allow users to choose their own workflow. I have uploaded a prototype in the recent commit.

b4zz4 commented 1 year ago

I add the option to keep the original material

https://github.com/chsh2/nijiGPen/pull/29

Pullusb commented 1 year ago

@chsh2 The feature is really nice ! Sorry for testing and responding this late.

With boundary stroke as hints, you did a really nice setup ! I think It would be very interesting to keep the hint layer field available.

Having a dedicated layer is still very interesting, because other layer can be dimmed with overlay, so you can see the result and where hints strokes actually are.

Both could be used as hint source.

image

In this scenario, for better modularity, I think exposing a toggle to disable hint scans in Fill layer could be a good idea.
like a "Use hints in Fills".

It will allow multiple workflow. e.g: In Fill layer, user could still use boundary stroke the way they were intended, without affecting the smart fill feature based on Hint layer only.

image

In any case. This is already a great addition !

chsh2 commented 1 year ago

Maybe the option text is a bit ambiguous, but if you select a separate layer as the hint (and leave the boundary stroke option unchecked), the boundary strokes in that layer will still be considered inputs.

The boundary stroke option is more like "use boundary strokes only". It makes more sense in the case where both hint strokes and fill strokes exist in the same layer, because the add-on needs a method to distinguish between them.

I try to make the workflow flexible, but without adding too many options. With a dedicated hint layer, you can use either boundary strokes or regular fill strokes (by drawing a small circle or something), or a mixture of the two: image

Pullusb commented 1 year ago

Ok! I did not test Boundary strokes as hints off. I didn't get it was already considering them without this option.

Then the behavior is perfect :+1: