shadow glitches in my custom light

Hey, I’m experimenting with custom light in my graph, it works ok, but I get some strange glitches in the shadows when the light changes.
5178290--513986--Nov-15-2019 11-49-09.gif

Heres the graph:

And the code in the custom function goes like this:

void LWRPLightingFunction_float (float3 ObjPos, out float3 Direction, out float3 Color, out float ShadowAttenuation)
{
#ifdef LIGHTWEIGHT_LIGHTING_INCLUDED
    //Actual light data from the pipeline
    Light light = GetMainLight(GetShadowCoord(GetVertexPositionInputs(ObjPos)));
    Direction = light.direction;
    Color = light.color;
    ShadowAttenuation = light.shadowAttenuation;
#else
    //Hardcoded data, used for the preview shader inside the graph where light functions are not available
    Direction = float3(-0.5, 0.5, -0.5);
    Color = float3(1, 1, 1);
    ShadowAttenuation = 0.4;
#endif
}

Is there something obvious I’m missing in order for this to work a little bit better?

Is it maybe because i’m using the emission output from the pbr master to render the color/shadow, and somehow have shadows twice?

it looks like ordinary self shadowing artifacts to me. you may try to adjust the shadow bias (normal, depth) of the light.