efficient 2D light source

by Julian   Last Updated May 28, 2018 10:13 AM

I wanted to add a light source for a project I'm working on, and luckily I had some code based on this article: http://ncase.me/sight-and-light/, but when I ran the code after carefully transplanting it I realized my implementation of lighting was really slow. In the previous project I only ever had to worry about a few polygons at a time, but in my new project there are a metric ton of different polygons that the ray caster is checking against. I can avoid testing every ray against every polygon side.



Related Questions


Shading a 2D visibility mesh to act like a light?

Updated March 04, 2016 01:05 AM

Does light source color defines its radiance?

Updated August 11, 2016 08:05 AM