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

Allow controlling fog blend mode / Add support for dark fog #8732

Closed
jcandres opened this issue Dec 27, 2023 · 2 comments
Closed

Allow controlling fog blend mode / Add support for dark fog #8732

jcandres opened this issue Dec 27, 2023 · 2 comments

Comments

@jcandres
Copy link

Describe the project you are working on

A retro 3D dungeon crawler.

Describe the problem or limitation you are having in your project

Fog in Godot 4 is difficult to art direct. Besides other changes, fog is now additive. That removes de possibility of using fog with a dark color (using pure black removes the fog), which is very useful for faking darkness in unlit scenes. This is particularly handy since fog is well integrated in the renderer and materials have built in options for fog interaction.
Also, additive fog also modifies the brightness of the scene making it harder to pick colors when accuracy is needed. For example matching fog color with the horizon's color takes a lot of trial and error.

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

Add a checkbox or a dropdown list to choose fog blend mode in WorldEnvironment.

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

See above.

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

No. Writing a custom shader using depth buffer is trivial but I believe this change needs to operate on an engine level to allow for materials to use the disable_fog flag.

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

See above.

@Calinou
Copy link
Member

Calinou commented Jan 1, 2024

Besides other changes, fog is now additive. That removes de possibility of using fog with a dark color (using pure black removes the fog), which is very useful for faking darkness in unlit scenes.

I can't reproduce this on 4.2.1:

image

Fog also applies to unshaded materials in 4.x, regardless of the rendering method used. You can disable fog on a per-material basis using the Disable Fog property in BaseMaterial3D or shader_mode fog_disabled in ShaderMaterial.

The fog blending formula is the same as in 3.x, it's just that fog is exponential instead of having a fixed begin/end distance: #4619

Fog rendering doesn't affect the sky when using the Compatibility rendering method, but it does when using Forward+ or Mobile. This is a bug: godotengine/godot#66456

@Calinou
Copy link
Member

Calinou commented May 16, 2024

Closing, as this is already implemented as of 4.2.1 (possibly earlier, I don't recall the fog blend mode actually being changed).

If you need further control on fog appearance, see #8743.

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

No branches or pull requests

2 participants