Skip to content

WIP: set a minimum amount of lighting #199

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

illwieckz
Copy link
Member

@illwieckz illwieckz commented Apr 7, 2019

The last time I updated The Dark Mod, I got a bug: there was no lighting. But I noticed everything was still visible. So I discovered that this stealth game relying a lot on darky zones never has pure black dark zones:

no light

no light

no light

I remembered the usual complain about the Unvanquished game being too darky, and I thought the idea was nice and I wanted the feature in Dæmon too, it's a gameplay issue.

Then I was yet another time annoyed by the ugly darky blotches of our non-sRGB lightmaps. And then the light came to my mind. If there is no pure dark zones, there can't be dark blotches.

Dark blotches come from the fact the current color curve does not have so much steps in the dark part, hence the shadows coming from average grey to pure black in one step.

So I implemented this hack. For every shadow color component between 0 and 0.18, rescale it between 0.06 and 0.18. The 0.06 value was chosen the empirical way by testing with some maps suffering a lot from the bug, and some other maps to ensure nothing wrong occurs. The 0.18 value was arbitrarily chosen without much thinking.

I really have no idea about the way to name this feature. Currently, the cvar is named r_floorLight, I highly recommend yourself to try this.

It's an easy hack to greatly improve the looking of our maps. sRGB lightmaps will tamper the need for such hack for good looking purpose, but since it's a good feature to always keep a minimum amount of light, it may be good to keep the feature and just adjust the numbers for the sRGB curve.

Note: it looks less good in thumbnails because the dark stuff being less contrasted, but it looks better in game this way:

floorlight

floorlight

floorlight

floorlight

floorlight

floorlight

floorlight

floorlight

floorlight

floorlight

floorlight

floorlight

floorlight

floorlight

There is one issue though, the usual "black" texture hack does not work anymore (well, the texture works, but the illusion does not work anymore):

floorlight

@illwieckz
Copy link
Member Author

Note: for some unknown reason I have to delete ~/.local/share/unvanquished/glsl between each vid_restart when I switch r_floorLight value.

@illwieckz illwieckz added T-Improvement Improvement for an existing feature T-Question A-Renderer labels Apr 7, 2019
@illwieckz
Copy link
Member Author

illwieckz commented Apr 7, 2019

Note that when maps are not really contrasted with this feature it just means the given maps have very low light, since it would mean that the average light of the given scenes would be very near the color step from where the grey becomes pure black…

@slipher
Copy link
Member

slipher commented Apr 8, 2019

Well this is a great cheat code for the humans 😛

Do we really want to have settings like that though? Which give an advantage to people who know to turn them on?

Alternatively, it could be turned on by default, but it seems bad that the renderer is not faithfully rendering what the output image should be according to the inputs.

@necessarily-equal
Copy link
Contributor

I must say I am unable to see a difference between your screenshots. That's probably my fault I guess, between strong redshift, low screen luminosity, and a laptop screen. But that also means those area are still pitch black for me :X

@necessarily-equal
Copy link
Contributor

Just as a note, I've been thinking of writing a shader for alien nightvision; and some are considering torchs https://forums.unvanquished.net/viewtopic.php?f=33&t=2097&p=17541#p17682. Maybe that could be a way to go?

@illwieckz
Copy link
Member Author

illwieckz commented Jan 3, 2021

That's probably my fault I guess

Your hardware's fault, you're fine. 😁


  1. This experiment was trying to workaround color banding.
  2. Also, it can be a feature request for the engine itself (for Unvanquished game or another) as an optional feature.

About color banding, three things are currently evaluated: dithering (fake gradient by mixing pixels), sRGB lightmaps (better colorspace that is less aggressive on low values), HDR lightmaps (more data means less banding).

About the feature itself, games like The Dark Mod reveal some game may want to have such feature anyway, so as a standalone engine it may be good to offer that option, but without an explicit need that's a low priority.

@illwieckz illwieckz marked this pull request as draft May 31, 2021 22:06
@ghost
Copy link

ghost commented Jul 20, 2022

There is one issue though, the usual "black" texture hack does not work anymore (well, the texture works, but the illusion does not work anymore):

What was that hack (the black texture) used for?

Also, I like the results on the screenshots. The difference is clear, it might even make some maps actually playable (hangar28), but this needs to be on by default, if we let this feature slip in gamelogic.
Is there any progress on the alternatives, non-hacky, ways? If not, maybe this hack is better than nothing?

@VReaperV
Copy link
Contributor

Is there any progress on the alternatives, non-hacky, ways? If not, maybe this hack is better than nothing?

There is now, in #1550. Funnily enough, the arbitrarily chosen 0.18 value here is mid grey, and is used by default as the dark-area point cut-off in #1550. It also doesn't break the black texture thing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Renderer T-Improvement Improvement for an existing feature T-Question
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants