Color Gradient On Curve

Hi,

I am trying to achieve a smooth color gradient along a curve between two points. The panel that I connected to the gradient slider shows that I did indeed achieve a gradient between white and black, but the custom preview is only showing the last parameter, which is black. I used the list item to ensure that the gradient was in fact working, and it is, but it seems like even though I am dividing the curve, when attached to the gradient component, each parameter reads as the entire curve length.

I tried using the Shatter Curve component as well to break the curve, which I saw in a previous post, but this did not work for me in the way I used it.

Any help with this seemingly simple problem would be awesome! :slight_smile:

Thanks

Line Color Gradient.gh (6.8 KB)

You can use ghgl like this:


GLShader.gh (3.9 KB)

5 Likes

Rhino.Display.DisplayPipeline.DrawGradientLines is available in Rhino 7

Here is a new version of the definition that uses the DrawGradientLines function to draw gradients.
Line Color Gradient.gh (20.0 KB)

13 Likes

Wow, I need to learn C#. So easy now.

Thank You!!! :slight_smile:

Be warned, that trick currently only works with lines. We don’t have an implementation that works with curves at this point in time.

Ah, ok. I also just tried baking the gradient in that line using the Human plugin and it didn’t show up… I think probably doing what I want with it might be easiest in Illustrator then.

Thanks again!

really nice @stevebaer! please the parameter stroke width could be as an input.
All fine on Windows but on MAC it doesn’t show width and this happens in GHGL as well, please consider to be fixed.

Ok
Line Color Gradient.gh (29.3 KB)

4 Likes

Would it be possible to insert different colors at different parameters of the curves? What do you think?

Absolutely that is possible. Here’s another sample
hello_shader.gh (25.8 KB)

2 Likes

That one is great but I think I could not explain myself clearly.

I would like to do something like the picture below.

I want to show these 1 and 2 parameters red and the gradient according to these. I have these dots for all the colors but I don’t know how to arrange the graident for that.

Thanks for the example again! Hope you have a solution for that too!

Best.

Hi @stevebaer
How to use list of colors to make gradient from list of lines in this case?
I have 0 knowledge in c# and python code will be helpful.

Line Color Gradient___.gh (11.3 KB)

Here’s an updated version of your definition
Line Color Gradient___.gh (30.7 KB)

1 Like

Thank you very much

Line Color Gradient___ (2).gh (18.1 KB)

4 Likes

Another way

curve color.gh (10.7 KB)

1 Like

Hi, @stevebaer please, could you fix it to work with trees? That would be really helpful, :pray:t2:!

Line Color Gradient_t.gh (24.7 KB)

Try this with Python

Curve Color Gradient.gh (10.7 KB)

image

Curve Color Gradient.gh (15.0 KB)

3 Likes

Can we bake it in same gradient in rhino