Shader "KernelPanic/add"
{
    Properties
    {
	    [HideInInspector] _MainTex ("Base (RGB)", 2D) = "white" {}
    }
    SubShader
    {
        Cull Off ZWrite Off ZTest Always Blend SrcAlpha OneMinusSrcAlpha
        
        Pass
        {
            
            CGPROGRAM
            #pragma vertex vert
            #pragma fragment frag

            #include "UnityCG.cginc"

            struct appdata
            {
                float4 vertex : POSITION;
                float2 uv : TEXCOORD0;
            };

            struct v2f
            {
                float2 uv : TEXCOORD0;
                float4 vertex : SV_POSITION;
            };

            v2f vert (appdata v)
            {
                v2f o;
                o.vertex = UnityObjectToClipPos(v.vertex);
                o.uv = v.uv;
                return o;
            }

            // This macro declares _BaseMap as a Texture2D object.
            // TEXTURE2D(_MainTex);
            // TEXTURE2D(_NoiseMap);
            
            // This macro declares the sampler for the _BaseMap texture.
            // SAMPLER(sampler_MainTex);
            // SAMPLER(sampler_NoiseMap);
            
            sampler2D _MainTex;
            sampler2D _BlendTex;
            
            float _Sample;

            fixed4 frag (v2f i) : SV_Target
            {
                // sample raw glitch

                float4 c = tex2D(_MainTex, i.uv);
                float4 b = tex2D(_BlendTex, i.uv);

                return lerp(b,c,_Sample);
                
                // float4 c = tex2D(_MainTex, i.uv);
                // c.a = _Sample;
                
                // float4 g = tex2D(_GlitchTex, i.uv);
                
                // return lerp(c,g,_Sample);

                return c;
            }
            ENDCG
        }
    }
}

