What is the best way to blend colour between two textures or line renderers?

I have a series of concentric circles made of line renderers whose colours are updated every frame and are controlled by music (see screen shot)

I would like to blend the colours from one circle to the next such that there are no sharp discontinuities. Would it be possible to do this using line renderers with some sort of shader? Or maybe the best way is to recreate it with some 2D texture whose vertices’ colours can be controlled via the script?

I’m quite new to Unity and C# so don’t really know the best way to go about this.

[38763-screen+shot+2015-01-14+at+12.39.50.png|38763].

Do you need each ring to be a separate entity, or are you just using LineRenderers for the shape?

If it’s just the shape you want, an easy way to do it is with a shader on a quad that samples from a lookup texture radially. The texture interpolation does the blending for you.

You can customize the look of the rings by painting in the lookup texture, and get cool animated effects by adjusting which part of the lookup texture you read from each frame (by playing with the texture scale & offset values in the material). Or, if you need the colours to be set dynamically, you can populate the lookup texture each frame using a script.

Here’s a simple shader that does this…

Shader "Custom/RadialRings" {
	Properties {
		_MainTex ("Base (RGB)", 2D) = "white" {}
	}
	SubShader {
		Tags { "RenderType"="Transparent" "Queue"="Transparent" "IgnoreProjector"="True" "ForceNoShadowCasting"="True"}
		LOD 200
		Lighting Off
        ZWrite Off
        Blend SrcAlpha OneMinusSrcAlpha
		
		Pass {
		CGPROGRAM
		#pragma vertex vs
		#pragma fragment fs
		#include "UnityCG.cginc"
		
		sampler2D _MainTex;
		float4 _MainTex_ST;
		
		struct v2f {
			float4 position : SV_POSITION;
			float2 uv	: TEXCOORD0;
		};
		
		v2f vs(appdata_base v) {
			v2f o;
			
			o.position = mul(UNITY_MATRIX_MVP, v.vertex);
			
			o.uv = v.texcoord - 0.5f;			
						
			return o;
		}
		
		fixed4 fs(v2f i) : COLOR {
			float2 radialLookup = float2(length(i.uv), 0.0f);
			
			return tex2D(_MainTex, TRANSFORM_TEX(radialLookup, _MainTex));
		}
		
		ENDCG
		}
	} 
	FallBack "Diffuse"
}