I believe I’ve posted a topic similar to this before, but it was quite a while ago. My goal is also somewhat more narrow this time.
I’m aiming to create a lighting system that uses an image overlay over the main rendering canvas to create light/shadow effects.
I’m stuck primarily at how to actually efficiently draw the light geometry to the image. I’m trying to avoid pixel-by-pixel iteration because it causes too much performance drop in the context of the rendering engine already.
Mathematically, I was planning on just using an inverse square relationship for light traveling:
L = A/(d^2) | L is luminance, A is absolute luminance (at one unit distance), and d is distance.
The main problem is applying this efficiently AND detecting light collision with entities in world space.
In other words, how can I calculate the shadow area (especially for objects that aren’t squares…) and then apply that lighting change to the image?
I’m looking for ideas and suggestions here, no specific method. If you have any ideas that don’t involve the light overlay, that’s fine too. I’m concerned about its performance anyway.
Thanks in advance for your help!