Creating static shadow-maps at runtime. Possible?

I have had some success creating my own custom depth map with a rt+scenecapture. I used that depth map to create shadows in the directional light’s material function.

However, My shadows arent nice and smooth like unreals. they are blocky. My Shadows:


UE4 shadows:

Does anyone know what the maths is to make ue4’s nice soft edged shadows?

Currently mine looks like this: