Shader "Carmen/SDF/Light Strip" { Properties { _MainTex ("_MainTex", 2D) = "white" {} _Color ("Color", Color) = (1,1,1,1) _Glow ("Glow", Range(0.0, 100.0)) = 0.0 } SubShader { Tags { "Queue"="Transparent" "RenderType"="Transparent" } LOD 200 Pass { Cull Off Blend SrcAlpha OneMinusSrcAlpha CGPROGRAM #include "UnityCG.cginc" #pragma vertex vert #pragma fragment frag UNITY_DECLARE_TEX2D(_MainTex); float4 _MainTex_ST; fixed4 _Color; half _Glow; struct Data { float4 vertex : POSITION; float4 normal : NORMAL; float2 uv : TEXCOORD0; }; struct V2F { float4 position : SV_POSITION; float2 uv : TEXCOORD0; }; V2F vert(Data v) { V2F o; o.position = UnityObjectToClipPos(v.vertex); o.uv = TRANSFORM_TEX(v.uv, _MainTex); return o; } fixed4 frag(V2F i) : SV_TARGET { half _LineThickness = 0.05; half sdf_sample = UNITY_SAMPLE_TEX2D(_MainTex, i.uv).r; half sdf_halfchange = (abs(ddx(sdf_sample)) + abs(ddy(sdf_sample))) / 2.0; half alphastep_loweredge = (1.0 - _LineThickness) - sdf_halfchange; half alphastep_upperedge = (1.0 - _LineThickness) + sdf_halfchange; half alphastep = saturate((sdf_sample - alphastep_loweredge) / (alphastep_upperedge - alphastep_loweredge)); //half3 Tex = UNITY_SAMPLE_TEX2D(_MainTex, i.uv).rrr; //if (Tex.r < 0.9) discard; return fixed4((_Color * (_Glow + 1.0)).rgb, alphastep.r); } ENDCG } } FallBack "Diffuse" }