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

Add Environment properties to make fixed and volumetric fog not affect sky rendering #4102

Closed
Calinou opened this issue Feb 23, 2022 · 5 comments · Fixed by godotengine/godot#60185

Comments

@Calinou
Copy link
Member

Calinou commented Feb 23, 2022

Describe the project you are working on

The Godot editor 🙂

Describe the problem or limitation you are having in your project

Fog rendering in Godot 4.0 always affects the sky rendering. This may not always desired, especially when you are using fog as an atmospheric effect (without intending it to be used for open world fog fading). For fixed (non-volumetric) fog, setting Aerial Perspective to 1 will let you see the background sky again, but it has a performance cost.

In comparison, fog in Godot 3.x never affects sky rendering.

Describe the feature / enhancement and how it helps to overcome the problem or limitation

Add a way to make fog rendering not fully affect sky rendering, so that the background sky can still be partially visible.

Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams

Add Fog Sky Affect and Volumetric Fog Sky Affect properties to Environment. By default, both would default to 1.0. If set to 0.0, then fog rendering will not affect the sky at all. Intermediate values will only partially affect sky rendering.

I have a WIP pull request implementing this: https://github.com/Calinou/godot/tree/environment-fog-add-sky-affect

If this enhancement will not be used often, can it be worked around with a few lines of script?

No, as this is core rendering functionality (implemented in the sky GLSL shader, which is not user-overwritable).

Is there a reason why this should be core and not an add-on in the asset library?

See above.

@clayjohn
Copy link
Member

Keep in mind, sky shaders have a disable_fog render mode and they can override the fog value using the FOG built-in. This allows the sky to show through the fog even if the fog is quite thick.

@Calinou
Copy link
Member Author

Calinou commented Feb 24, 2022

Keep in mind, sky shaders have a disable_fog render mode and they can override the fog value using the FOG built-in. This allows the sky to show through the fog even if the fog is quite thick.

I see, I wasn't aware about that. Maybe disable_fog should be exposed in the inspector for the various default Sky resources (like godotengine/godot#55551 did for filter modes)?

@clayjohn
Copy link
Member

@Calinou I think thats the way to do it if this is desired! We could also expose the FOG builtin as a uniform as well if users desire it.

@mrjustaguy
Copy link

Having that option is very much desired, it greatly increases the flexibility of the fog and is very straight forward.

@clayjohn
Copy link
Member

Related to this proposal, I noticed that the current dependency on z-far distance also breaks when using reflection probes as the z-far distance changes between probes. Unless you set the probe's max_distance to be the same as the camera's z-far you end up with a different amount of fog between the sky and the reflected sky.

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

Successfully merging a pull request may close this issue.

4 participants