I need a shader for my procedural mesh (basically a quad) to fill it with a gradient. Not just any gradient however, a shaped one. Could anybody please guide me or give me any ideas on how to create such a shader. Check the attached images.
I figured it out. You just have to modify the vertex colors of the mesh.
Unity Mesh Colors
Color[] colors = new Color[meshVertices.Length];
for (int i = 0; i < meshVertices.Length - 1; i++)
colors *= Color.Lerp(centreColor, edgeColor,*
Vector3.Distance(meshVertices*, meshVertices[4]));*
colors[4] = centreColor;
mesh.colors = colors;
To produce the the results in the attached images, ensure that your mesh has at least 5 vertices, 4 corners and one centre.