Shader "Unlit/RadialGradient" {
Properties {
_Color ("Center Color", Color) = (1,1,1,1)
_OuterColor ("OuterColor", Color) = (1,1,1,1)
_Radius( "Radius", Float ) = 1.0
_Falloff( "Falloff", Float ) = 1.0
}
SubShader {
Tags { "RenderType"="Opaque" }
LOD 200
Pass
{
Cull Off
Lighting Off
ZWrite Off
Fog { Mode Off }
ColorMask RGB
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#include "UnityCG.cginc"
fixed4 _Color;
fixed4 _OuterColor;
fixed _Radius;
fixed _Falloff;
struct appdata_t
{
float4 vertex : POSITION;
float2 texcoord : TEXCOORD0;
};
struct v2f
{
float4 vertex : POSITION;
float2 texcoord : TEXCOORD0;
};
v2f vert (appdata_t v)
{
v2f o;
o.vertex = mul(UNITY_MATRIX_MVP, v.vertex);
o.texcoord = v.texcoord;
return o;
}
fixed4 frag (v2f IN) : COLOR
{
float2 d = IN.texcoord.xy - float2( 0.5, 0.5 );
float l = length( d );
fixed4 col = lerp( _Color, _OuterColor, l );
return pow( col,_Falloff )* _Radius ;
}
ENDCG
}
}
FallBack Off
}