// Flat tinted panel background (replaces Sprites/Default on the shoulder panel) with the distance dither fade.
Shader "VrchatHoldem/ShoulderPanelBackground"
{
    Properties
    {
        _Color ("Color", Color) = (0.04, 0.04, 0.07, 0.7)
        _FadeNear ("Fully Visible Within (m)", Float) = 3.75
        _FadeFar ("Hidden Beyond (m)", Float) = 4.5
    }
    SubShader
    {
        Tags { "Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent" }
        Cull Off
        ZWrite Off
        Lighting Off
        Blend SrcAlpha OneMinusSrcAlpha

        Pass
        {
            CGPROGRAM
            #pragma vertex vert
            #pragma fragment frag
            #include "UnityCG.cginc"
            #include "ShoulderPanelDither.cginc"

            fixed4 _Color;

            struct appdata
            {
                float4 vertex : POSITION;
                fixed4 color : COLOR;
                UNITY_VERTEX_INPUT_INSTANCE_ID
            };

            struct v2f
            {
                float4 vertex : SV_POSITION;
                fixed4 color : COLOR;
                UNITY_VERTEX_OUTPUT_STEREO
            };

            v2f vert(appdata v)
            {
                v2f o;
                UNITY_SETUP_INSTANCE_ID(v);
                UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
                o.vertex = UnityObjectToClipPos(v.vertex);
                o.color = v.color * _Color;
                return o;
            }

            fixed4 frag(v2f i) : SV_Target
            {
                ShoulderPanelDitherClip(i.vertex);
                return i.color;
            }
            ENDCG
        }
    }
}
