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
[No squash] Corrections to entity and node light calculation #12741
Conversation
@@ -881,7 +881,7 @@ void GenericCAO::updateLight(u32 day_night_ratio) | |||
if (!pos_ok) | |||
light_at_pos = LIGHT_SUN; | |||
|
|||
video::SColor light = encode_light(light_at_pos, decode_light(m_prop.glow)); | |||
video::SColor light = encode_light(light_at_pos, m_prop.glow); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
glow
is a value between [0, LIGHT_SUN] but encode_light
treats the increment parameter as a value between [0, 255] for the effective brightness, hence the decode_light
call here was more correct than the current code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have added comments explaining how glow is used now:
- Glow now impacts light level of the entity in the getInteriorLight call
- A small boost is added to the final color to make entities brighter at the same light level
@x2048 rebase needed |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
This PR fixes two things:
glow
property to work on the light levels (0..LIGHT_MAX):a. Glow is added to the map light level at the node position, before converting to the color space
b. Additional brightness is added at the final stage in the same was as for light sources
The reason for a single PR is that light calculation for both scenarios is based on getInteriorLight function
Fixes #12686 in a formally correct way.
To do
This PR is Ready for Review.
How to test
In devtest:
Test 1:
Note, depending on your hardware, dim light sources (1-3) may not be visible in full darkness.
Test 2: