New gradient mesh tool usage

General discussions about Inkscape.
msdobrescu
Posts: 44
Joined: Tue Aug 02, 2011 6:50 am

New gradient mesh tool usage

Postby msdobrescu » Thu Jan 26, 2017 5:24 am

Hello,

Is it possible to create a gradient mesh from an irregular shape with respect to the shape's boundaries?

For example, I start from this stroke:

1 stroke.png
1 stroke.png (171.65 KiB) Viewed 2298 times


I convert it to path:

2 stroke to path.png
2 stroke to path.png (156.79 KiB) Viewed 2298 times


I wish to get a mesh like this:

3 mesh.png
3 mesh.png (175.47 KiB) Viewed 2298 times


I have drawn a white dotted line for mesh'es middle column "separator" and, ideally, row "separators" should connect the other path nodes.

Would this be possible in the future?

For example, in Illustrator is very frustrating the control of the mesh rows and columns positioning when the mesh is created and further work if more or less are needed. Could Inkscape beat it in this regard?

Lazur
Posts: 4578
Joined: Tue Jun 14, 2016 10:38 am

Re: New gradient mesh tool usage

Postby Lazur » Thu Jan 26, 2017 5:42 am

Hi.

Made a similar feature request before -click the "this bug affects you" button, maybe it can get more attention.

As far as the second commend goes it looks off from the current working structure and probably there would be other difficulties as well.
For example when you bend a pattern, new nodes are added to fit the geometry but with gradient meshes that wouldn't be an option?

Here is a trick described to "emulate" a bent gradient.

My guess would be multistroke attributes -strokes stacked with different widths atop eachother- will be implemented before bending gradient meshes but who knows. That could also simulate a bent gradient effect.

Interpolation and interpolate within a group is available at the present, as well as gradient mapping filters so sort of the look can already be achieved.

msdobrescu
Posts: 44
Joined: Tue Aug 02, 2011 6:50 am

Re: New gradient mesh tool usage

Postby msdobrescu » Thu Jan 26, 2017 6:15 am

Bending is a solution, but not the only one.

I took a segment and created a mesh over and worked on it to bend it approximately:

sm bent.png
sm bent.png (206.18 KiB) Viewed 2285 times


In this case, I see probably more steps to have a gradient between the outer and longer arch than on the inner arch, which is shorter.

IMHO, this would be a solution for bending algorithm you discussed in the feature request.
It is a natural approach.

I see a bug, probably, in the middle of the mesh, the blue arch is not covered, surprisingly on the short transition between the arches of the mesh.
Attachments
s2.svg
(9.8 KiB) Downloaded 35 times

Lazur
Posts: 4578
Joined: Tue Jun 14, 2016 10:38 am

Re: New gradient mesh tool usage

Postby Lazur » Thu Jan 26, 2017 6:46 am

By using the render stroke handles extension and snapping you can draw it exactly.

s2II.svg
(22.83 KiB) Downloaded 49 times


The blue part is because you added the mesh to the stroke and not to the blue fill instead (without strokes).

msdobrescu
Posts: 44
Joined: Tue Aug 02, 2011 6:50 am

Re: New gradient mesh tool usage

Postby msdobrescu » Thu Jan 26, 2017 6:48 am

There was not a bug... I think, increasing the stroke weight solved the issue.

msdobrescu
Posts: 44
Joined: Tue Aug 02, 2011 6:50 am

Re: New gradient mesh tool usage

Postby msdobrescu » Thu Jan 26, 2017 6:53 am

Imagine doing it with a couple of clicks, one for selecting the path to create the mesh, other to specify a corner...
Probably some extension could be written to do that.

User avatar
brynn
Posts: 9962
Joined: Wed Sep 26, 2007 4:34 pm
Location: western USA
Contact:

Re: New gradient mesh tool usage

Postby brynn » Thu Jan 26, 2017 2:29 pm

Oh yes, I find dragging those node/stops around to fit whatever kind of object it is, is one of the most time consuming parts of using the gradient mesh tool. A one or 2 click solution would be awesome.

But really, how could Inkscape make any kind of guess about the object? Because in your example of an S shaped, stroked path, well the existing option to fit to the bounding box would do the same job as your 2 click idea. Unless I'm not understanding it.

Maybe somehow using whatever it is in the Paint Bucket tool that can "see" an enclosed space, would work? The object would first have to be either filled with a solid color, or stroked with no fill. But that doesn't seem like too much work.

msdobrescu
Posts: 44
Joined: Tue Aug 02, 2011 6:50 am

Re: New gradient mesh tool usage

Postby msdobrescu » Thu Jan 26, 2017 4:53 pm

I have experience with Illustrator and I must say it is pretty hard to fit a shape sometimes.
Anyway, if the possibility to decide by one click where the corners of the mesh are would help for a rectangular mesh.
For circular mesh, no corners are needed, just a center point, probably.
Lazur's technique would be great for the initial fit, adding mesh points snapped to the handles would perform a very good job.
Think what as there is no mesh concept separated from path in the first step, using the path nodes initially.
Then the user could add mesh points and rows and columns.

User avatar
brynn
Posts: 9962
Joined: Wed Sep 26, 2007 4:34 pm
Location: western USA
Contact:

Re: New gradient mesh tool usage

Postby brynn » Fri Jan 27, 2017 8:49 pm

Anyway, if the possibility to decide by one click where the corners of the mesh are would help for a rectangular mesh.


I might not be understanding what you're asking. But doesn't that already exist? There's a button on the control bar to fit the mesh to the bounding box.

Unless you mean for rectangles that are not aligned along horizontal or vertical axis? Do you mean, align the corner mesh nodes to the corner path nodes of the rectangle?

Lazur
Posts: 4578
Joined: Tue Jun 14, 2016 10:38 am

Re: New gradient mesh tool usage

Postby Lazur » Fri Jan 27, 2017 9:03 pm

Feature requested is to automagically snap mesh edges&nodes on a preexisting path by one click.
Unlike this case, a match is never self explanatory. How would you match a mesh to an "X" or # shaped path? What if its a compound path like an "Ő"?
There is no trivial solution nor is there an indication on the shape's structure once the "S"'s outer edges/strokes got converted to path in the original example.
By bending a shape with a mesh fill there is probably can be at least an indication of which node to be placed at which position.

msdobrescu
Posts: 44
Joined: Tue Aug 02, 2011 6:50 am

Re: New gradient mesh tool usage

Postby msdobrescu » Fri Jan 27, 2017 9:30 pm

Why not starting from the path nodes (with their handles)? At least as an option? This would simplify the process, starting from a further step.
Why creating a squared or round mask and struggle to match it to a shape (when a match is needed)? All the data is already there.
You have some arbitrary shape, go to the mesh tool and select it, check on its options to match the chosen shape and try to create a squared or round mesh. Inkscape would ask for two adjacent corners for squared mesh or center for the round mesh. Then have fun by adding mesh nodes. Some options could be added as in Illustrator's Mesh Tormentor addin - double mesh nodes, half them, divide it by some nodes (even from the inner) etc..
This would increase productivity and let the fun of designing instead of struggling matching the mesh.
You've already, Lazur, used somehow a shortcut by using the handles effect and snapping to them, isn't it?
If there are problems, we could find solutions to them.

User avatar
brynn
Posts: 9962
Joined: Wed Sep 26, 2007 4:34 pm
Location: western USA
Contact:

Re: New gradient mesh tool usage

Postby brynn » Sun Jan 29, 2017 8:28 pm

Lazur wrote:Feature requested is to automagically snap mesh edges&nodes on a preexisting path by one click.
Unlike this case, a match is never self explanatory. How would you match a mesh to an "X" or # shaped path? What if its a compound path like an "Ő"?
There is no trivial solution nor is there an indication on the shape's structure once the "S"'s outer edges/strokes got converted to path in the original example.
By bending a shape with a mesh fill there is probably can be at least an indication of which node to be placed at which position.


Oh, I understand better now. I was confused about msdobrescu saying click on a corner, and it made me think of the bounding box.

To my simple way of thinking, the Paint Bucket tool can "see" or detect either solid spaces or enclosed spaces. I was wondering (earlier) if there would be any way to use that functionality. Inkscape could "see" the object, and when you click on the canvas, somehow align the nodes and handles to the shape. Instead of creating a new path, it would create the mesh nodes and handles.

msdobrescu wrote:Why not starting from the path nodes (with their handles)? At least as an option? This would simplify the process, starting from a further step.
Why creating a squared or round mask and struggle to match it to a shape (when a match is needed)? All the data is already there.
You have some arbitrary shape, go to the mesh tool and select it, check on its options to match the chosen shape and try to create a squared or round mesh. Inkscape would ask for two adjacent corners for squared mesh or center for the round mesh. Then have fun by adding mesh nodes. Some options could be added as in Illustrator's Mesh Tormentor addin - double mesh nodes, half them, divide it by some nodes (even from the inner) etc..
This would increase productivity and let the fun of designing instead of struggling matching the mesh.
You've already, Lazur, used somehow a shortcut by using the handles effect and snapping to them, isn't it?
If there are problems, we could find solutions to them.


That sounds reasonable to me. It would be sort of like duplicating the path, except instead of new paths, it creates the mesh nodes and handles. It does make sense that the information is already available, at least in XML code (if not some other internal data).

Are you going to make a feature request?

Lazur
Posts: 4578
Joined: Tue Jun 14, 2016 10:38 am

Re: New gradient mesh tool usage

Postby Lazur » Sun Jan 29, 2017 9:20 pm

brynn wrote:To my simple way of thinking, the Paint Bucket tool can "see" or detect either solid spaces or enclosed spaces.


Bucket tool can't see anything. It uses the rendered screen pixels as a visual reference, creates a "raster fill", sort of a raster editor would do, then traces it for a vector output. It doesn't even fill in all the area you would need when you zoom in.

Instead of the bucket tool functionality think in the terms of "trace bitmap" with a gradient mesh.
Sounds rather different, although theoretically you could assign mesh nodes to every pixel corners. Result would be enermous to handle and would be so handy with the existing manipulating options.
A bend lpe or envelope-perspective would be nice to pair up with such a trace as well.


But assigning mesh nodes over a plain vector object?
Thinking of a "#" shape, where would you place the mesh nodes manually?

msdobrescu
Posts: 44
Joined: Tue Aug 02, 2011 6:50 am

Re: New gradient mesh tool usage

Postby msdobrescu » Sun Jan 29, 2017 10:07 pm

To clarify things, when I say "click on a corner", I want to say "click on a node to set a mesh corner there, meaning that node to become a mesh corner".
I name "mesh corner" one of the four nodes defining the rectangle boundaries of the squared mesh.
Sorry for my fuzziness.

User avatar
brynn
Posts: 9962
Joined: Wed Sep 26, 2007 4:34 pm
Location: western USA
Contact:

Re: New gradient mesh tool usage

Postby brynn » Sun Jan 29, 2017 11:05 pm

I did put "see" in quotes. I know it really doesn't see anything. But I was thinking that detecting rendered screen pixels would be one way for Inkscape to know where to put the mesh. I would be happy with approximation here. Another way might be to use the XML code which defines the path nodes.

msdobrescu wrote:To clarify things, when I say "click on a corner", I want to say "click on a node to set a mesh corner there, meaning that node to become a mesh corner".
I name "mesh corner" one of the four nodes defining the rectangle boundaries of the squared mesh.
Sorry for my fuzziness.


Oh, now I understand!

User avatar
brynn
Posts: 9962
Joined: Wed Sep 26, 2007 4:34 pm
Location: western USA
Contact:

Re: New gradient mesh tool usage

Postby brynn » Mon Jan 30, 2017 7:28 am

Happened to stumble on this. Less details than you've discussed, but isn't this what you mean? Or do I still not understand?

https://bugs.launchpad.net/inkscape/+bug/1659977

msdobrescu
Posts: 44
Joined: Tue Aug 02, 2011 6:50 am

Re: New gradient mesh tool usage

Postby msdobrescu » Mon Jan 30, 2017 7:30 pm

Yes and no.
My idea was to create a gradient mesh starting from the path definition and how to do this in the first place, as a UI process too.
The feature request above is related to what happens after, which is a fine idea.


Return to “General Discussions”

Who is online

Users browsing this forum: No registered users and 2 guests