Static Lighting Generator 2

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


By some stroke of luck, I managed to fix that last bug and finish version 2.3 of my Static Lighting Generator. Go check it out, it's pretty cool.

Unfortunately, I didn't get to implement the really cool optional features I had hoped too, but I did get all of my required ones:

Static Lighting Generator 2.3
- Transfer to libpng √
- Support for southward-facing walls √
- Support for rectangular icon_sizes √
- Upgrade to filter-strip method √
- Support for perspective-skew √
- Semi-transparent walls (optional) ~
- Light shapes (optional) ~

(√ means done, ~ means almost done)

As much as I would love to spend one more day trying to get those last two in, I've got finals coming up and I need to get back to my real work. Anyways, the more I look at it, the less I think transparency is fully working. Also, if working on this has taught me anything, things never go as planned, and never take as long as you expect.





That bottom screenshot looks familiar ;)
I can't get it to work, the exe keeps spitting out "FILE ERROR: couldn't access file!"
SuperAntx wrote:
I can't get it to work, the exe keeps spitting out "FILE ERROR: couldn't access file!"

That error means that it couldn't load the input file ("lightMap_data.txt" by default) or that something went wrong while reading it.

Did you do anything unusual? Remove or rename anything? Set any options? Are you running it out of your BYOND user directory, or somewhere else?
AIM IT UP
The file lightMap_data.txt contains the following after the exe fails.
{"
52 52
{{{{{{{{{{{{{{{{{{{{{{{{{{{{{a
{{{{{{{{{{{{{{{{{{{{{{{{{{{{{a
"}

I haven't changed anything, this is an error I'm getting simply from running Generate() with SLG2.dm included. What's odd is the demo itself seems to work, but if I try to use it in any other project I get the same file error.
Ah, your map is empty. Something I didn't test, and can fix easily.

Add a light, and it should work fine. Also, be aware that the demo uses a seperate variable for blocking light, and not atom.opacity. You can make the change easily, though, by updating turf/proc/getOpacity()
Oh, I see why it's doing that now. You have it hardcoded only to generate light for the first z level.
SuperAntx wrote:
Oh, I see why it's doing that now. You have it hardcoded only to generate light for the first z level.

The demo verb, yea. I'm actually not sure what it'll do if you pass light_generate() two turfs on different z-levels...

Would make sense, though, as it would save space if they shared the tiles.


I should probably write a blurb about how to copy the demo into your own games, since it's probably a bit confusing. That, or just stuff all the options into the demo verb so they can be chosen at runtime.
It looks nice with the 2.5D perspective, but there's this problem.

It would also be nice to see how it looks with mobs placed on the map. I expect it would look weird when a mob is standing in such a way that their top half is inside a shadow and their bottom half isn't, but I can't tell how strange that would look.
Forum_account wrote:
It looks nice with the 2.5D perspective, but there's this problem.

It would also be nice to see how it looks with mobs placed on the map. I expect it would look weird when a mob is standing in such a way that their top half is inside a shadow and their bottom half isn't, but I can't tell how strange that would look.

Hmmm, you're right. For the first point, you could manually fix that by using a turf that's set to be non-opaque for the top/back of the wall.

As to the second, I'm not sure there's much I can do. Even if I made extra "layers", I wouldn't be able to get the vertical effect like the walls have. If you have any ideas, I'd love to hear them.
Forum_account wrote:
It looks nice with the 2.5D perspective, but there's this problem.

Thanks for the suggestion, I fixed the screenshot using non-opaque walls for the top sections.
Certain formations give really odd results. I also noticed you can't have light sources on top of walls which is a bummer.
SuperAntx wrote:
Certain formations give really odd results. I also noticed you can't have light sources on top of walls which is a bummer.

In the older version, you could put light on top of an opaque tile and it could escape that tile. However, if you want it within an entire section of wall, I would have to add some sort of "light layers" bit-flag that controlled which walls blocked which lights.

As to the screenshot, are the lights placed in-line with the torches? If so, I agree that it's odd the darkest spots are closest to them..


But now that I think about it, a light placed on the floor directly in front of the wall would be more accurate.
As to the second, I'm not sure there's much I can do. Even if I made extra "layers", I wouldn't be able to get the vertical effect like the walls have. If you have any ideas, I'd love to hear them.

I've been trying to think of a solution since I first saw you post about this but I haven't come up with anything. The problem results because you want to represent 3D objects but the lighting effect is 2D - there must be situations it can't handle. You can avoid this by using it purely as top-down and you can minimize the problem by avoiding sharp, drastic changes in lighting, but I don't think there's an easy way to make it work.
DarkCampainger wrote:
As to the screenshot, are the lights placed in-line with the torches?

Yup.
The dark spots being below the torches is somewhat believable. From your screenshots the additive power of lights seems extreme. The points between torches are lit by multiple torches, below the torch is lit by just one.
I understand what you mean, it certainly follows its own logic correctly. Even in a row of overlapping torches the brightest spots should still be the tiles the torches are sitting on. Those tiles are supposed to have the highest possible luminosity..

This is also a trouble spot, the light should be blending together.
It's hard to tell what's going on because there isn't much contrast between light and dark anywhere. It looks like the dark spots are just below where the lights are placed. Maybe if you replace all turf icons with a plain white icon it'd be easier to see the exact effect the lights are having.
I'm looking into a better blending method than addition. If you guys have any suggestions, I'd love to hear them. I tried A+B(1-A), but it only helped a little.
Page: 1 2 3