Skip to content
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

Editor: Fix default preview environment sky's horizon and brightness. #99957

Merged

Conversation

StaydMcMuffin
Copy link
Contributor

Closes #99701

This addresses two issues with the default preview environment's sky. First is the horizon always appearing grey, even when both the sky and ground colors are set to black. Second is the fact that the "Sky Energy" slider only affects the top hemisphere of the sky, while the lower hemisphere's brightness cannot be modified.

The first issue occurs because the horizon color is generated automatically from the sky and ground colors, rather than being exposed to the user. This is desirably convenient of course, except that the horizon color is generated as first a 50/50 blend between the sky and ground colors, and then a 50/50 blend between the result and pure white. This second blend is why the horizon remains grey even when the user would reasonably expect it to be pitch black.
To fix this, the second blend has been replaced by a 50/50 blend with the first blend result's luminance multiplied by 3.333 (an arbitrary value, chosen to maintain roughly the same horizon brightness that the original method produced with the default sky and ground colors).

The second issue is similarly perplexing from a user's perspective; the "Sky Energy" slider modifies the preview sky's sky_energy_multiplier rather than its energy_multiplier, meaning that only the upper half of the sky is affected, while the user has no way of modifying the ground_energy_multiplier for the lower half. For the sake of keeping the preview environment's interface simple and quick to use, I've opted to make the slider alter the sky's energy_multiplier property, rather than add a second slider for the ground, as I believe the more convenient use of such a slider is to quickly modify the sky's overall brightness, as well as its associated ambient light. I also frankly wouldn't be surprised if the use of sky_energy_multiplier instead of energy_multiplier was a mistake from the start, given that its name doesn't necessarily indicate it's specifically for the top of the sky.

With sky and ground colors set to pure black:

Before After
image image

With "Sky Energy" slider set to 0.25:

Before After
image image

With default sky and ground colors:

Before After
image image

Fixes the horizon color being grey even when both
the sky and ground colors are set to black, and
makes the energy slider affect both hemispheres
rather than only affecting the top "sky" portion.
@StaydMcMuffin StaydMcMuffin requested a review from a team as a code owner December 3, 2024 10:36
@hpvb
Copy link
Member

hpvb commented Dec 3, 2024

Looks good to me! Elegant solution to the problem.

Copy link
Member

@clayjohn clayjohn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great!

@clayjohn clayjohn modified the milestones: 4.x, 4.4 Dec 3, 2024
@Repiteo Repiteo merged commit e5d62fa into godotengine:master Dec 3, 2024
20 checks passed
@Repiteo
Copy link
Contributor

Repiteo commented Dec 3, 2024

Thanks! Congratulations on your first merged contribution! 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Editor] setting the preview environment to all black still leaves the horizon
4 participants