Ugly shadow cascades visible in custom unlit shader

I’m trying to make my custom unlit shader recieve shadows in URP.

To do this I get the main light via the shadow coord in the fragment shader:
Light mainLight = GetMainLight(i.shadowCoord);

The shadow coord is fetched like this:
o.shadowCoord = TransformWorldToShadowCoord(worldPos);

And for testing I simply do this:
return mainLight.shadowAttenuation;

But as you can see, there are these white and black rings. They are caused by the shadow cascades but I don’t know how to get rid of them.

Any ideas?

Result:

Solution:
Had to remove #pragma multi_compile _ _MAIN_LIGHT_SHADOWS_CASCADE from the shader.

Edit: This creates another issue where realtime shadow mapping doesn’t work any more

Give this a go

1 Like

Thanks @DevDunk . The implementation was using the same methods as mine but as I read “shadergraph” I noticed that these nodes will most likeley be used for the fragment shader.

I was calculating the shadow coord in the vertex stage and that’s why it looked ugly. It didn’t get interpolated correctly in between the stages.

Ah I hoped there would be some extra keywords that might have helped ya