Shader "Custom/JoystickCircle" { Properties{ _Color ("Main Color", Color) = (1,1,1,1) _Falloff ("Falloff", Float) = 0.025 } SubShader { Tags { "Queue" = "Transparent" "IgnoreProjector" = "True" "RenderType" = "Transparent" "PreviewType"="Plane" } Pass { Blend SrcAlpha OneMinusSrcAlpha Cull Off Lighting Off ZWrite Off ZTest Always Fog { Mode Off } CGPROGRAM #pragma vertex vert #pragma fragment frag #include "UnityCG.cginc" float _Falloff; float4 _Color; struct v2f { float4 pos : SV_POSITION; float3 color : COLOR0; float2 uv : TEXCOORD0; }; v2f vert (appdata_base v){ v2f o; o.pos = mul (UNITY_MATRIX_MVP, v.vertex); o.color = v.normal * 0.5 + 0.5; o.uv = v.texcoord.xy; return o; } half4 frag (v2f i) : COLOR{ float radius = length(i.uv - 0.5f) * 2.0f; //clip(1.0f - radius); float falloffRadius = 1.0f - clamp(radius, 1.0f - _Falloff, 1.0f); float falloff = pow(falloffRadius / _Falloff, 1.0f / 2); float3 color = falloff; return half4 (_Color.rgb, _Color.a * falloff); } ENDCG } } Fallback "VertexLit" }