Shadow quality issues with custom shader

Hey guys,

I am creating a game with a custom shader graph cell shader, that also uses keywords to receive shadows. My problem is that those shadows are really low resolution, even though my shadow resolution is at 4096 and I am using cascades.
Also, soft shadows don’t seem to work at all.


I know that soft shadows are disabled in the screenshot, it simply did not change anything when activated.
I am using URP in Unity 2021.3.21f1.
I am also using the keywords:
MAIN_LIGHT_CALCULATE_SHADOWS,
_MAIN_LIGHT_SHADOWS_CASCADE and
SHADOWS_SOFT
in my shader to get shadows.
I am not really doing anything else to those shadows in the shader.

Does anybody know what could cause this or how to fix it?
Thanks,
Hannes


Send the shader

I am using pretty much unitys official method for custom lighting:

void MainLight_float(float3 WorldPos, out float3 Direction, out float3 Color,
    out float DistanceAtten, out float ShadowAtten)
{
#ifdef SHADERGRAPH_PREVIEW
    Direction = normalize(float3(0.5f, 0.5f, 0.25f));
    Color = float3(1.0f, 1.0f, 1.0f);
    DistanceAtten = 1.0f;
    ShadowAtten = 1.0f;
#else
    #if SHADOWS_SCREEN
        half4 clipPos = TransformWorldToHClip(WorldPos);
        half4 shadowCoord = ComputeScreenPos(clipPos);
    #else
        float4 shadowCoord = TransformWorldToShadowCoord(WorldPos);
    #endif
 
    Light mainLight = GetMainLight(shadowCoord);
    Direction = mainLight.direction;
    Color = mainLight.color;
    DistanceAtten = mainLight.distanceAttenuation;
    ShadowAtten = mainLight.shadowAttenuation;
#endif
}

void MainLight_half(half3 WorldPos, out half3 Direction, out half3 Color,
    out half DistanceAtten, out half ShadowAtten)
{
#ifdef SHADERGRAPH_PREVIEW
    Direction = normalize(half3(0.5f, 0.5f, 0.25f));
    Color = half3(1.0f, 1.0f, 1.0f);
    DistanceAtten = 1.0f;
    ShadowAtten = 1.0f;
#else
    half4 shadowCoord = TransformWorldToShadowCoord(WorldPos);
    Light mainLight = GetMainLight(shadowCoord);
    Direction = mainLight.direction;
    Color = mainLight.color;
    DistanceAtten = mainLight.distanceAttenuation;
    ShadowAtten = mainLight.shadowAttenuation;
#endif
}

Can you also send the shader graph you mention?

Its pretty much this, so not that complex at all:

The Attenuation in the GetMainLight subgraph is the only calculation in there and its just DistanceAttenunation * ShadowAttenuation