1

I am pretty new to shaders in unity and am stuck on a problem. I am using ShaderGraph and unity 2021. I understood the ShaderGraph examples from the unity page and "implemented" an OutlineShader thinking I could simply "inverse" the direction (not multiply by some value to get a bigger object then coloring that object and laying the original object ontop). Yet I am nowhere near what I want. Basically what I am trying to achive is a stepped color gradient to the inside of the object. As an image it should look something like this:

stepped color grade

Starting from color0 (green) going inward to color1 (yellow) until i reach the center with colorN (white) and repeat the same for the other side. The shader is then used on a material that is applied to a MeshLineRenderer (LineRendererPro from asset store with minor modifications for custom behavior) which kind of looks like this:

mesh line renderer

In the end the line should be colored according to the specified colors and the direction the line is going.

enter image description here

Explanation of a simple "Inline" Shader (similar to an outline) would help alot. I think I would be able to adapt that concept and implement multiple colors with (maybe) percentages of width. I don't want to use a fixed image/texture since i want to change the widths and colors.

Any input is welcome and thank you in advance.

Reborok
  • 25
  • 6
  • 1
    Shader doesn't matter as much as the UV coordinates. You gotta make sure the line renderer is generating them for all vertices going from 0 to 1. – Iggy Jun 01 '22 at 15:36
  • I know i should probably add that: The UVs of the generated mesh line are set. I just don't know how to generate the texture based on varibales for colors and widths etc – Reborok Jun 01 '22 at 17:21

0 Answers0