I modified the code from this github repository: https://github.com/Miziziziz/2D-directional-shadows-godot