-
-
Notifications
You must be signed in to change notification settings - Fork 21.4k
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
Add exponential fog #24596
Comments
It cannot be just changed, it should be an option instead, because as you said it would prevent some artistic choices, such as having models crossing the far clip to blend with the horizon color. |
Maybe it would be a solution to rename the current implementation to something like "fade to background" and add exponential fog as a physical based solution. Probably the strength of spot or point lights should decrease with the distance too, as their emitted light gets absorbed from the fog in the same way. |
If we rename or change anything it would break compatibility so it would be something for 4.0 in this case. |
If it will be an option it would not break compatibility |
Fade to background (skybox) is not easy to implement for now because it requires a texture unit and there are too many of them in use already. With Vulkan port it should be easy to add, as it can be bindless. |
@reduz I was mostly mentionning that because it's possible to approximate it, as skyboxes can have a relatively uniform horizon. |
Introduces a new parameter, exponential fog density, which allows a default for exponential fog while preserving fog's alpha color channel to specify fog density. The commit also adds missing hide_prefixes[] for height and depth fog properties. Requires godotengine#36989. Should fix godotengine#24596.
Added in #41240 |
Godot version:
3.1, commit 10e9221
The current implementation of fog is in my opinion visually not convincing (and I saw other issues stating the same). As the shader code states the fog is a smoothstep between the unfogged color and the color of the fog, based on the distance between the near and far value.
This gives, in combination with the custom depth curve much artistic controll, but is not based on any physical principles.
A more physically plausible result would probably be to use:
fog_amount = 1.0 - exp( -fog_z * fog_density )
where
float fog_z = length(vertex)
without any smoothstep.
To me, the results were much more convincing.
I don't know the theory behind the additional transmission effect for coloring the fog, but using exponential decay there as well produces visually very pleasing results which are at least more plausible even if still not physically correct.
This would replace the fog curves and distances with a single density parameter.
The text was updated successfully, but these errors were encountered: