Re: Line and Polyline gradient color feature

Avatar
  • updated
  • Under Consideration

Is it possible to have gradient color feature for Line and polyline, such that we can have color variant from outer edge lerping towards center of the line?

Reporting a bug? please specify Unity version:
Reporting a bug? please specify Shapes version:
Reporting a bug? please specify Render Pipeline:
Built-in render pipeline
Avatar
chris gregan

I'm looking to do something similar, though I just need to fade from the main color at the center of a Line to fully transparent at the edge (so the second color would always just be clear). I'm going to start digging around the shader code to see if I can get this to work - any advice on how to do it?

Avatar
Freya Holmér creator
  • Under Consideration

Could you elaborate a little on what you mean, more specifically?

it sounds similar to this request (having outer/inner/center colors of each point in the polyline)
or this request (having the color overlay fill)
or this request (multi-color gradients with stops)

Avatar
chris gregan
Sure, I'm looking to draw a colored line that fades from alpha 1 along the center of the line to alpha 0 at the edge of the line, like in this image. I only need to draw a single color fading out to the edge, rather than a gradient between multiple colors.

Avatar
yoonack

I think the pic shown by chris is what I wanted.

Avatar
Wisp

voted up! Yes, multi-stop gradient, similar to Unity's would be stellar. 


Or, a simpler one for now which would be a couple lerps instead of 1.

So, A->B, B->C, C->D. Below the image shows how we could get a fade on the start and end of the line, with an optional gradient for the interior. It would be quite flexible and cover most of what people would want to do. Especially if this is a vector4(XYZW) which would let us move the positions for start of gradients ect. This could be a Quad option in the enum you have now :)

Image 812