I’m working on a simple 2D lighting system. I’m attempting to make a cone ‘light’ area, wherein the objects within are drawn normally. Outside of this cone of light, a black overlay with 0.5f alpha will be drawn, causing all drawn objects outside the cone to appear darker. Imagine a torch in 2D. See the below diagram:
So the way I was thinking of going about this was to somehow specify an inverse cone of light, and draw it with an alpha level of 0.5f and a black color after drawing my objects, like a dark semi-transparent overlay. That should work in theory, but I have no idea how to specify this inverted cone of light!
Any help would be much appreciated.
An alternative would be just as good, as I’m not sure I’m going down the right path here. I have experimented with different blending modes, with no luck.
Thanks in advance!