adjust lighting debug overlay to show exact light values #35110
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
SUMMARY: Infrastructure "adjust lighting debug overlay to show exact light values"
Purpose of change
While the lighting overlay introduced in #31260 would be very helpful for troubleshooting a lot of lighting-related issues, it displays light values in a counter-intuitive fashion (the lowest value is the brightest, the highest value is the darkest), and it clamps maximal brightness such that the actual internal values cannot be inspected easily.
Describe the solution
Adjusted the text overlay portion of the lighting debug overlay to use the raw ambient light value for each tile.
I didn't make any changes to the highlight algorithm. I'm not convinced the color range is appropriate (particularly since it doesn't actually seem to consistently line up with either the rendering thresholds for bright or low light, nor
lit_level
), but I also don't know what could be more useful/informative than what we have now.Describe alternatives you've considered
i also considered attempting to include other information such as the current
lit_level
(see:lightmap.h
), but I couldn't figure out how to make the text overlay present that usefully; it already tends to overlap very badly if you aren't zoomed in fairly close.It's also possible to introduce additional light overlay modes; one of the interesting surprises I found while pursuing this was that in the main game state there's a
View Lighting Map
key binding (default unbound). This doesn't simply toggle on the debug lighting overlay; it actually invokes a UIList where you can select a specific overlay.That list just happens to only contain one item right now, and there isn't any handling for alternate
displaying_lighting_condition
values in the overlay logic.If needed, these changes could instead be contained within a second lighting overlay. Other overlays could also be added (to attempt to account for other adjustments to lighting other than ambient, for instance, or to show
lit_level
)If someone else has some specific needs for this tool that involve the original behavior, or a different behavior, expanding the options for overlay types is definitely on the table. I'm just not sure the current values in
master
are actually of use to anyone in particular, especially when chasing corner cases of lighting. SeeAdditional context
below.Testing
Spent quite a bit of time fiddling with this these edits while trying to chase down some other issues with the lighting system. This version at least does what I need for that work.
Additional context
Old overlay values:
New overlay values:
Notably: In these screenshots i'm not using the default map font size of 8, 16, 16, but instead 6, 12, 12. This lets the numbers fit slightly more neatly, but not quite neatly enough to be readable at the next zoom level up. :(
As an example of an exceptional failure state with the old values:
This is the edge of the lit area from the overhead lights on a luxury RV at night. My character is currently standing in the "shadow" area where the light source is falling off, but the debug light overlay claims it's a light level value of 1.0.
Same area, with raw ambient light values: