Static Lighting Generator 2

by DarkCampainger
Static Lighting Generator 2
Generate advanced soft-edge static lighting. Now using an EXE!
ID:111419
 

With large radii support, you can now create eclipse-like antumbra effects!


Version 2.2 (3/31/11) - Bug Fixes and More!

Fixed faint "tile outlines" in shadows

Shadows are now properly symmetrical

Large radii values are now supported (just keep it on the map, and outside walls!)

Fixed duplication of last light

Added comments and cleaned up demo code

Added "Penumbra.dmm" example map to showcase the effects of different light source radii values


Most of these bugs were due to really, really dumb mistakes. Most of them arose when I decided it would be easier (and it was) to work with my data if it was all in the same units (ie just tiles, instead of pixels and tiles mixed).

Anyway, long story short, I accidentally left in a subtraction of 1/(icon_size*2) from a key component of the line equation, which was throwing everything just a tiny bit off and hurdling my line walking into an infinite loop.

Of course, there was also a flaw in how I was converting everything from pixels to tiles, which resulted in a slight jump in perceived values from tile to tile (creating a "tiling" effect hidden in my tests by my accursed fancy tiled flooring!)

These fixes did have the bonus side-effect of making the shadows properly symmetrical, which is nice to finally have working right.

Anyway, I'm just glad it's all working now and I won't have to look at it for a while. Life lesson. Now maybe I can finally find time to actually use the sucker. You should use it too if you're making a small top-down game ;)

(also, I've got a fan! :3 )

Looks sweet. What's up with the triangular light in the shadow at the topright though? Shouldn't that be dark?
SpikeNeedle wrote:
Looks sweet. What's up with the triangular light in the shadow at the topright though? Shouldn't that be dark?

Nope, that's the eclipse effect I was talking about: the bulb is so huge the light being emitted from its left and right sides actually reaches the other side of the wall!
Ah, I see. It looks pretty unnatural to me because you have two vertical angles, one is light and the other is extremely dark in comparison to its surroundings.
DC, how can I get in touch with you outside of the pager? You're never on AIM anymore... :[
DarkCampainger wrote:
SpikeNeedle wrote:
Looks sweet. What's up with the triangular light in the shadow at the topright though? Shouldn't that be dark?

Nope, that's the eclipse effect I was talking about: the bulb is so huge the light being emitted from its left and right sides actually reaches the other side of the wall!

Try replacing the large light source with many smaller lights that cover the same area. Both should produce similar results, but I don't think you'll get that bright triangle with the many lights method.

In your screenshot it looks like nearly 100% of the light is reaching that triangle, when it should really be much less than that.
Any chance you'll add support for varying degrees of translucency for walls?
SpikeNeedle wrote:
Ah, I see. It looks pretty unnatural to me because you have two vertical angles, one is light and the other is extremely dark in comparison to its surroundings.

Forum_account wrote:
Try replacing the large light source with many smaller lights that cover the same area. Both should produce similar results, but I don't think you'll get that bright triangle with the many lights method.

In your screenshot it looks like nearly 100% of the light is reaching that triangle, when it should really be much less than that.

Now that it isn't 4:00AM, I see the problem with my method. Because it finds that the left and right sides of the light reach that point, it's assuming that the full left-to-right plane of light reaches it. I suppose I would need to add another pair of bounds to my line walking to track the "interior" bounds of the light as well.
D4RK3 54B3R wrote:
DC, how can I get in touch with you outside of the pager? You're never on AIM anymore... :[

You can shoot me an email at darkcampainger care/of gmail

That or catch me on Steam :)
SuperAntx wrote:
Any chance you'll add support for varying degrees of translucency for walls?

Hmmm, that's an interesting question. Back when I had hard-shadows, it would have been trivial to add. I think I have an idea on how to do it, though. So if you need them, I can add them.