How to get line with variable stroke width and perpendicular-aligned linear gradient? (solved: interpolation)

Post questions on how to use or achieve an effect in Inkscape.
romanshuvalov
Posts: 8
Joined: Sun Feb 07, 2016 6:10 am

How to get line with variable stroke width and perpendicular-aligned linear gradient? (solved: interpolation)

Postby romanshuvalov » Sun Feb 07, 2016 6:32 am

Greetings. I'm trying to create something like this:

Image

But smoother (smooth gradient from center to sides) and more "friendly for editing". I tried to use "Pattern along path" effect, but it's not exactly that I want, because that way only pattern geometry is used as a pattern, gradient is ignored. Same thing with "Arrange to line".

Is it possible?
Last edited by romanshuvalov on Tue Feb 09, 2016 12:19 pm, edited 1 time in total.

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

Re: How to get line with variable stroke width and linear gradient aligned perpendicular?

Postby Lazur » Sun Feb 07, 2016 6:35 am

Hi.

You can use the bend lpe on groups for such effect.
(Draw the gradiented shape as a group of paths and apply the lpe on it.)

romanshuvalov
Posts: 8
Joined: Sun Feb 07, 2016 6:10 am

Re: How to get line with variable stroke width and perpendicular-aligned linear gradient?

Postby romanshuvalov » Sun Feb 07, 2016 7:12 am

Thank you, but what about non-constant thinkness? And "gradiented shape as a group of paths" can't be smooth anyway, right?

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

Re: How to get line with variable stroke width and perpendicular-aligned linear gradient?

Postby Lazur » Sun Feb 07, 2016 7:34 am

It can look exactly as you depicted in your image. Are you after a smooth transition?
Would need filtering to draw something close.
Or using gradient meshes, but both seems to be an overkill for a line drawing.
Keep in mind that this is a vector drawing program and strokes with realistic fading lines like with watercolour and wet brush are more fractal-like. Too much data to be rendered at once, probably better to use a raster editor for that.

If the original intention is to draw with such lines.
If not, interpolating paths and fill attributes can look smooth enough.

hulf2012
Posts: 716
Joined: Sat Nov 24, 2012 12:37 pm

Re: How to get line with variable stroke width and perpendicular-aligned linear gradient?

Postby hulf2012 » Mon Feb 08, 2016 1:38 am

Hello

If you have already the first image of your first post in SVG, just apply a blur (or a filter for blurring) to them (I think it can be applied to the group of them) , and you will see that the colour transitions become smoother.

About "friendly for editing", I don't see how. It will depends of the use you want, how far you want to edit: move it, bend it, change the colous or opacity?.
If you have problems:
1.- Post a sample (or samples) of your file please.
2.- Please check here:
http://tavmjong.free.fr/INKSCAPE/MANUAL/html/index.html
3.- If you manage to solve your problem, please post here your solution.

romanshuvalov
Posts: 8
Joined: Sun Feb 07, 2016 6:10 am

Re: How to get line with variable stroke width and perpendicular-aligned linear gradient?

Postby romanshuvalov » Mon Feb 08, 2016 3:45 am

Move it, and bend it, and change colors and opacity :)

Thank you for your replies, now I know that there is no magic trick that help me reach exactly that I want, but I will use your advices to reorganize my principles of drawing.

Polygon
Posts: 393
Joined: Thu Dec 19, 2013 3:27 am

Re: How to get line with variable stroke width and perpendicular-aligned linear gradient?

Postby Polygon » Mon Feb 08, 2016 6:30 am

Have you tried to interpolate already?

Image

Cheers
P.

romanshuvalov
Posts: 8
Joined: Sun Feb 07, 2016 6:10 am

Re: How to get line with variable stroke width and perpendicular-aligned linear gradient?

Postby romanshuvalov » Tue Feb 09, 2016 1:13 am

That's exactly that I wanted! Interpolation is that magic tool I was looking for. Many thanks.

(Well, gradients will be "stepped", not ideal, because it's impossible to get infinite number of steps, but, as it was said already, this is vector graphics so let's assume it's ok).

User avatar
Espermaschine
Posts: 892
Joined: Thu Jun 05, 2014 9:10 pm

Re: How to get line with variable stroke width and perpendicular-aligned linear gradient?

Postby Espermaschine » Tue Feb 09, 2016 1:15 am

@romanshuvalov

So what exactly do you want to do with this shape ?

romanshuvalov
Posts: 8
Joined: Sun Feb 07, 2016 6:10 am

Re: How to get line with variable stroke width and perpendicular-aligned linear gradient?

Postby romanshuvalov » Tue Feb 09, 2016 3:11 am

I plan to use it as "shade" (shadow) of non-flat surface. This particular example has sharp beginning and ending, but using interpolation from small shape to 100% transparent bigger shape gives result that can be used for my purposes.

User avatar
Espermaschine
Posts: 892
Joined: Thu Jun 05, 2014 9:10 pm

Re: How to get line with variable stroke width and perpendicular-aligned linear gradient?

Postby Espermaschine » Tue Feb 09, 2016 3:25 am

romanshuvalov wrote:I plan to use it as "shade" (shadow) of non-flat surface.

Like a bevel ?

Polygon
Posts: 393
Joined: Thu Dec 19, 2013 3:27 am

Re: How to get line with variable stroke width and perpendicular-aligned linear gradient?

Postby Polygon » Tue Feb 09, 2016 8:30 am

romanshuvalov wrote:(Well, gradients will be "stepped", not ideal, because it's impossible to get infinite number of steps, but, as it was said already, this is vector graphics so let's assume it's ok).

Well - you can smooth it by blurring it and masking the shape to whatever you like - just to let you know. :mrgreen:

Cheers
P.

romanshuvalov
Posts: 8
Joined: Sun Feb 07, 2016 6:10 am

Re: How to get line with variable stroke width and perpendicular-aligned linear gradient?

Postby romanshuvalov » Tue Feb 09, 2016 12:17 pm

Yes, like a bevel.

No, blurring does not give same result.

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

Re: How to get line with variable stroke width and perpendicular-aligned linear gradient? (solved: interpolation)

Postby Lazur » Tue Feb 09, 2016 4:14 pm

If you use blurring then why not using fecomposite instead of masking?

diffu1.svg
(5.75 KiB) Downloaded 186 times

romanshuvalov
Posts: 8
Joined: Sun Feb 07, 2016 6:10 am

Re: How to get line with variable stroke width and perpendicular-aligned linear gradient? (solved: interpolation)

Postby romanshuvalov » Thu Feb 11, 2016 3:37 am

Thank you for your tip, but my goal is different.

It will not be just shape with bevel. It will be non-flat surface like this:

ImageImage
(this is fragment of OpenCycleMap)

Do you see that small gray shadows? That's that I'm trying to draw. In my case it's impossible to draw real relief in order to apply diffuse lighting.

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

Re: How to get line with variable stroke width and perpendicular-aligned linear gradient? (solved: interpolation)

Postby Lazur » Thu Feb 11, 2016 5:53 am

Still a bit confused.

That map has isolines, which you can generate a 3D surface upon and add diffuse lighting to it.*
So how is that impossible, in theory?

Because in action the isoline's vectors alone can be heavy.
And what the output format would be?
If you want to print it from a pdf, the filters need to be rasterized, so you would end up with embedded raster images -can be machine melting large if the resolution/size is too big.


*Blender has a nice add-on to triangulate point clouds.
With subdivision surface modifier you can make it look more polished, and you can render a raster image of it in "any" size.

hulf2012
Posts: 716
Joined: Sat Nov 24, 2012 12:37 pm

Re: How to get line with variable stroke width and perpendicular-aligned linear gradient? (solved: interpolation)

Postby hulf2012 » Thu Feb 11, 2016 4:58 pm

I'm guessing romanshuvalov wants that, based in the isolines, and vector for a direction of light , some parts of the map have "shadows"... maybe using filters: offsetting and blurring. We need an expert in SVG filters here.

The other way is doing by hand and eye, adding patches of blurred shapes.

But if it just need interpolations... well... glad He found the solution,.. allthough... I don't understand the original problem neither.
If you have problems:
1.- Post a sample (or samples) of your file please.
2.- Please check here:
http://tavmjong.free.fr/INKSCAPE/MANUAL/html/index.html
3.- If you manage to solve your problem, please post here your solution.

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

Re: How to get line with variable stroke width and perpendicular-aligned linear gradient? (solved: interpolation)

Postby Lazur » Thu Feb 11, 2016 7:27 pm

My previous example had a diffuse filter added for the effect.
It's "real" 3D shading instead of blurring and offsetting, though that's not so complicated to make either.

romanshuvalov
Posts: 8
Joined: Sun Feb 07, 2016 6:10 am

Re: How to get line with variable stroke width and perpendicular-aligned linear gradient? (solved: interpolation)

Postby romanshuvalov » Thu Feb 11, 2016 11:12 pm

That map has isolines, which you can generate a 3D surface upon and add diffuse lighting to it.*
I predicted that answer... No, I don't have any isolines, this is just an example. Sorry I didn't found example that exactly shows I need to reach.

Anyway I think I found solution (interpolation + blur) so I have no problem anymore. Thank you for help.


Return to “Help with using Inkscape”