[URP] Custom shader not receiving shadows

Working on a simple custom shader and can’t make it receiving shadows. I’m guessing something changed with the way URP does that but couldn’t find an answer in the unity docs. I’m using 2019.3 beta

Shader "imagoFX/Vertex Colors"
{
    Properties
    {
        _Color ("Color", Color) = (0.5, 0.5, 0.5, 0.5)
    }

    SubShader
    {
        Tags { "Queue" = "Geometry"}
       
        CGINCLUDE
        #pragma vertex vert
        #pragma fragment frag
       
        #include "UnityCG.cginc"
        #include "AutoLight.cginc"
       
        uniform fixed4 _Color;
        uniform float4 _LightColor0;
       
        struct v2f
        {
            float4 pos : SV_POSITION;
            float4 color : COLOR;
            float3 normal : NORMAL;
            LIGHTING_COORDS(1,2)
        };
       
        v2f vert (appdata_full v)
        {
            v2f o;
           
            o.pos = UnityObjectToClipPos(v.vertex);
            o.color = v.color;

            float4x4 modelMatrix = unity_ObjectToWorld;
            float4x4 modelMatrixInverse = unity_WorldToObject;

            float3 normalDirection = UnityObjectToWorldNormal(v.normal);
            float3 lightDirection = normalize(_WorldSpaceLightPos0.xyz);
           
            float3 diffuseReflection = _LightColor0.rgb * max(0.0, dot(normalDirection, lightDirection));
            o.color += float4(diffuseReflection, 1.0);
            o.pos = UnityObjectToClipPos(v.vertex);

            TRANSFER_SHADOW(o)

            return o;
        }
        ENDCG
   
        Pass {
            CGPROGRAM
       
            fixed4 frag (v2f i) : COLOR
            {
                return _Color * i.color * SHADOW_ATTENUATION(i);
            }
            ENDCG
        }
    }
    FallBack "VertexLit"
}

your shader is written for built in forward. if you want to make in run in urp including shadows you have to entirely rewrite the shader…
have a look at the Lit shader for example that ships with urp.

Isn’t urp forward renderer?
I did check the lit shader and didn’t understand a thing but I’ll check it again.

it is. but a completely different forward renderer – especially when it comes to lighting.
so yur shader will output something to screen using urp. but it does not get any lighting as “AutoLight.cginc” does not sample urp shadows.
and i even doubt that using _LightColor0 or _WorldSpaceLightPos0 will contain any data.

Thanks for the info

if you need to receive shadow on unlit shader, it can need to modified shadow pass.

visit this link you can find answer.