-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
expose new scalar to change the visual density of fog #12248
base: main
Are you sure you want to change the base?
Conversation
Thank you for the pull request, @jjspace! ✅ We can confirm we have a CLA on file for you. |
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.
Thanks @jjspace. A few comments on the code.
Please also add a unit test and update CHANGES.md.
Yes, I was looking at a horizon few similar to this one. This is what prompted my question. I agree that from your more "aerial" screenshots, the density does read correctly at a value of My guess for what is causing this may be the atmosphere scattering code returning transparent colors for fog when close to the ground. Perhaps try stubbing out the atmosphere color function with one that returns a solid color for the sake of debugging. Once we identify the cause, we can figure out an implementation plan, and if it's scope. If that's not the case, my shot in the dark is that this may be related to #11922. The horizon angle is what's jumping out to me as similar.
I agree. I assume that will be out of scope for this PR. I believe the reasons for this are documented in #11717 (comment). |
@ggetz I fixed up the couple docs issues and moved the fog sandcastle as discussed offline. That said I'm still confused what's causing the fog to be basically non-existant close to the ground and have such a massive spike in density at a certain height. I tried swapping the fog color out for a static magenta simplescreenrecorder-2024-10-21_15.39.28.mp4 |
Description
0.15
to0.4
which should make the densest fog possible right around where tiles are culled0.15
0.4
Density function details
These graphs show the density function values. The y value between 0 and 1 is used to determine the percentage for mixing the original color and the fog color.
mix(originalColor, fogColor, percent)
ie. closer to 1 means more fog color
Any tile with a value greater than 1 is culled and thus not rendered
Any tile or model with a value less than
0.001
does not get any fog color at all to aid in performance, the fog would be negligible.The red line is the "true" fog function that is calculated without any scalar. This is the one used for culling
The purple line is the fog function with the modifier included. The purple area is where fog is actually being displayed
This is the before value with a modifier of
0.15
This is the same functions with a modifier of
0.4
. As you can see the fog (purple) much closer matches reaching 1 around the same time the red fog function does. This means it's visually most dense at around the same distance tiles are culled.The density is cranked up way higher than normal to make seeing the curves clearer
Desmos link if you want to play with the values yourself
(the
v
value is there to exaggerate the graphs visually so you can still see the curves even if you stretch the density out really far)Issue number and link
Part of #12126
Testing plan
Author checklist
CONTRIBUTORS.md
CHANGES.md
with a short summary of my change