Shader "Infinity Code/Online Maps/Tileset Fade Shader" { Properties { _Color("Main Color", Color) = (1,1,1,1) _MainTex("Base (RGB) Trans (A)", 2D) = "white" {} _OverlayBackTex("Overlay Back Texture", 2D) = "black" {} _OverlayBackAlpha("Overlay Back Alpha", Range(0, 1)) = 1 _TrafficTex("Traffic Texture", 2D) = "black" {} _OverlayFrontTex("Overlay Front Texture", 2D) = "black" {} _OverlayFrontAlpha("Overlay Front Alpha", Range(0, 1)) = 1 } SubShader { Tags{ "Queue" = "Transparent-100" "IgnoreProjector" = "True" "RenderType" = "Transparent" } LOD 200 CGPROGRAM #pragma surface surf Lambert alpha sampler2D _MainTex; fixed4 _CircleColor; float _CircleBorderWidth; fixed4 _CircleBorderColor; uniform int _CountItems; uniform float4 _Items[1000]; struct Input { float2 uv_MainTex; float3 worldPos; }; void surf(Input IN, inout SurfaceOutput o) { fixed4 c = tex2D(_MainTex, IN.uv_MainTex); fixed3 rgb = c.rgb; const float2 wp = float2(IN.worldPos.x, IN.worldPos.z); [loop] for (int i = _CountItems - 1; i >= 0; i--) { float4 item = _Items[i]; const float r = distance(wp, float2(item.x, item.z)); if (r < item.w - _CircleBorderWidth) { rgb = lerp(rgb, _CircleColor.rgb, _CircleColor.a); break; } else if (r < item.w) { rgb = lerp(rgb, _CircleBorderColor.rgb, _CircleBorderColor.a); break; } } o.Albedo = rgb; o.Alpha = c.a; } ENDCG } Fallback "Transparent/Cutout/Diffuse" }