Shader "Hidden/USAYALib/Outline/Halo" {
    Properties {
        _MainTex ("Main", 2D) = "black" {}
        _GlowTex ("Glow Object", 2D) = "black" {}
        _GlowColor ("Glow Color", Color) = (0, 1, 1, 1)
        _CutOut ("Cut Out", Float) = 0.5
    }

    SubShader {
        Blend SrcAlpha OneMinusSrcAlpha
        Pass {
            CGPROGRAM
            #pragma vertex vert_img
            #pragma fragment frag

            #include "UnityCG.cginc"

            sampler2D _MainTex, _GlowTex;
            float4 _GlowColor;
            float _CutOut;

            float4 frag(v2f_img i) : SV_Target {
                float r = tex2D(_GlowTex, i.uv).r;
                clip(-r);
                float4 result = _GlowColor;
//                result.a *= (r < 1.0 && tex2D(_MainTex, i.uv).r > _CutOut) ? 1.0 : 0.0;
                result.a *= (1.0 - step(1.0, r)) * (1.0 - step(tex2D(_MainTex, i.uv).r, _CutOut));
                return result;
            }
            ENDCG
        }
    }
}