2D Light shadows overlapping issue

I’m troubleshooting a lighting issue with my game. I know very little about the technical aspects of rendering lighting as most engines hold your hand quite a bit with that. So I used the example for lights and shadows here “https://github.com/defold/sample-lights-and-shadows” Not sure if I should be using this or if there’s a better solution but this worked great until I started adding more lights with bigger radius to fill out the level. I didn’t really change any code from the sample since I don’t fully understand how it works anyways. I don’t even know what it is exactly that replicates what I’m seeing or why it’s rendering this way in the screenshots.


Shows 3 lights working just fine.


Turning 2 additional lights on at the top of the screen in a different room, now the red light and bottom left white light have these broken shadows or light paths or whatever. :face_with_raised_eyebrow: (I mean look at the light shape of the bottom left, how does that make sense? :confounded:)

Some context for the screenshots, light radius is at largest 1200 and smallest 256 (the red light) and all lights go in a 360 degree arc. Dynamic or static lights makes no difference. I ruled out the code for the switch turning the lights on and off as a culprit since I get the same behavior when I manually set up the lights. I can show code but most scripts from the sample-lights-and-shadows repo are unmodified and I’m not really sure what code to show.

Any help appreciated! Also anyone that can give me a better technical description of what I’m seeing is also appreciated.

1 Like