[2D][Sprites] Superposition of alpha sprites

Greetings Unity community,

This marks my inaugural post here, having often found solutions to my queries within this community. However, despite consulting numerous developers and attempting independent development, I have been unable to achieve the desired outcome. Here’s the situation:

I am working with Unity 3D for a 2D game, where my characters have their primary sprite and an additional sprite representing their shadow. Unfortunately, when one shadow overlays another in a manner that visually multiplies the alpha channel, it disrupts the shadow effect. How can I address this issue, possibly through the application of a shader with a magical bend, ensuring that the alpha values of the sprites do not accumulate?

I appreciate your assistance.

PS: Attached is an image where two shadows intersect.
image

I dont have much experience on 2D side of things but ı tried to look up a solution. Not sure if it works for you but just adding my two cents until a better reply find you.

https://forum.unity.com/threads/2d-issue-with-overlapping-transparent-objects.355025/

There is also another stackoverflow link:

I hope this helps you. Have fun creating.

Edit: Found more resources adding them here;

https://forum.unity.com/threads/blending-alpha-values.352085/

For those looking for a solution with 2D games, here’s the source code for the shader I use:

Shader "Custom/CanvasImageMask"
{
    Properties
    {
        [PerRendererData] _MainTex ("Sprite Texture", 2D) = "white" {}
        _Color ("Tint", Color) = (1,1,1,1)
    }

    SubShader
    {
        Tags
        { 
            "Queue"="Transparent" 
            "IgnoreProjector"="True" 
            "RenderType"="Transparent" 
            "PreviewType"="Plane"
            "CanUseSpriteAtlas"="True"
        }

        Stencil
        {
            Ref 1
            Comp Greater
            Pass Replace
        }

        Cull Off
        Lighting Off
        ZWrite Off
        ZTest [unity_GUIZTestMode]
        Blend SrcAlpha OneMinusSrcAlpha
        ColorMask RGBA

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

            struct appdata_t
            {
                float4 vertex   : POSITION;
                float4 color    : COLOR;
                float2 texcoord : TEXCOORD0;
            };

            struct v2f
            {
                float4 vertex   : SV_POSITION;
                fixed4 color    : COLOR;
                half2 texcoord  : TEXCOORD0;
            };

            fixed4 _Color;

            v2f vert(appdata_t IN)
            {
                v2f OUT;
                OUT.vertex = UnityObjectToClipPos(IN.vertex);
                OUT.texcoord = IN.texcoord;
#ifdef UNITY_HALF_TEXEL_OFFSET
                OUT.vertex.xy += (_ScreenParams.zw-1.0)*float2(-1,1);
#endif
                OUT.color = IN.color * _Color;
                return OUT;
            }

            sampler2D _MainTex;

            fixed4 frag(v2f IN) : SV_Target
            {
                half4 color = tex2D(_MainTex, IN.texcoord) * IN.color;
                clip (color.a - 0.01);
                return color;
            }
        ENDCG
        }
    }
}

Source: Unity: UI Image alpha overlap - Stack Overflow