Dynamic shadows artifacts

Can you share the code for both methods so we can use whichever works better in game as a temporary solution?