Top down 2D shadows being infinite

On the latest version of Godot, I am making a top down game but I’m struggling to find a way to make shadows that are not infinitely long; where they can stop after a certain distance to make it seem better. I have no experience with shaders but I know that they’ll probably be the answer, i want it to work with my tilemap as well as, hopefully, my character2Ds

I quite like the look of this guy’s shader, Limiting shadow length 2d - #2 by capitainejsparrow but again, have no clue how to set them up - and it seems to not be dynamic (as in, if i add another fence it seems i would have to change stuff in the code, etc due to things like [sub_resource type=“OccluderPolygon2D” id=“OccluderPolygon2D_8qdvh”]
polygon = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8) or 1:1/0/occlusion_layer_0/polygon = SubResource(“OccluderPolygon2D_5m8o1”)
1:1/0/terrains_peering_bit/right_side = 0
1:1/0/terrains_peering_bit/bottom_side = 0
1:1/0/terrains_peering_bit/left_side = 0
0:1/0 = 0

so i was wondering if anyone had their own shaders they use for top down games like mine:

or if they could explain how to use a/the persons shader and set it up. Feel free to ask questions.

It doesn’t look that any code interventions are required. You just need to maintain the light occluders so that the engine properly generates the sdf texture the shader relies on.

ah, ty! But i still dont know how exactly to set up the shader, could you tell me?

Why not download that project, tinker with it and see how they set it up, then replicate that in your project.