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 project settings to globally disable resource-intensive Environment features #5229

Open
Calinou opened this issue Aug 22, 2022 · 3 comments

Comments

@Calinou
Copy link
Member

Calinou commented Aug 22, 2022

Describe the project you are working on

The Godot editor 🙂

Describe the problem or limitation you are having in your project

On low-end GPUs or mobile devices, significant performance gains can be obtained by disabling demanding Environment post-processing features.

However, this isn't very convenient to do right now, especially in projects that use different Environment resources.

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

Add project settings to globally disable resource-intensive Environment features. This includes:

  • Auto Exposure
  • SSAO
  • SSIL
  • SSR
  • SDFGI
  • Glow
  • Volumetric Fog

Cheap features such as tonemapping, non-volumetric fog and adjustments probably don't need similar "kill switch" settings, as there is little reason to disable them globally.

This should also be adjustable at run-time, so that graphics settings menus can adjust these options without having to get the Environment resource (which is cumbersome for projects that have different environments in each level).

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

This would require adding project settings, but also RenderingServer properties for run-time changes. I suggest naming the settings as such (example for volumetric fog):

  • ProjectSettings.rendering/environment/effects/allow_volumetric_fog (only read when the project starts)
  • RenderingServer.environment_allow_volumetric_fog (can be changed at run-time)

If set to true, the environment is allowed to use volumetric fog. (In other words, setting this to true does not enable volumetric fog globally). If set to false, volumetric fog is always disabled, even if the Environment resource requests it.

These settings are ignored while in the editor, so that you can always preview Environment effects without having to toggle the settings back on. They will however be respected when running the project in the editor.

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

Yes, if your project only uses a single Environment in all its scenes. Otherwise, no, as every environment has its own toggles.

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

This is about making 3D graphics settings easier to implement. Since these menus are must-have for scalability across various GPUs, it's important to make this process as seamless as possible.

Keywords for easier searching: postprocess, postprocessing

@clayjohn
Copy link
Member

Related to: #2183

@Calinou
Copy link
Member Author

Calinou commented Sep 16, 2022

I have a WIP implementation of this (only for glow currently): https://github.com/Calinou/godot/tree/environment-add-effect-allow-properties

Testing project: test_environment_allow.zip

@clayjohn Is this implementation sound, and can it be made to work in OpenGL without code duplication? The underlying code doesn't need to change much between backends – it only needs to override the environment getter's value with false if the effect is not allowed.

@clayjohn
Copy link
Member

@clayjohn Is this implementation sound, and can it be made to work in OpenGL without code duplication? The underlying code doesn't need to change much between backends – it only needs to override the environment getter's value with false if the effect is not allowed.

I would add the check in the environment storage class so you only need to do it once and it works everywhere.

Here is where glow is set:
https://github.com/godotengine/godot/blob/95df3e7c88f4c044a46b45239a3d447a71f05446/servers/rendering/storage/environment_storage.cpp#L380

You could add a variable to environment like force_disable_glow and then at the top of environment_set_glow() have:

if (force_disable_glow) {
    return;
}

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