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

OpenGL: Environment fog does not affect sky rendering #66456

Closed
Tracked by #69579 ...
Calinou opened this issue Sep 26, 2022 · 7 comments · Fixed by #95662
Closed
Tracked by #69579 ...

OpenGL: Environment fog does not affect sky rendering #66456

Calinou opened this issue Sep 26, 2022 · 7 comments · Fixed by #95662

Comments

@Calinou
Copy link
Member

Calinou commented Sep 26, 2022

Godot version

4.0.beta (53d2a9a)

System information

Fedora 36, GeForce GTX 1080 (NVIDIA 515.65.01)

Issue description

Unlike in Vulkan, environment fog does not affect sky rendering when using the OpenGL renderer. Fog Sky Affect's value is ignored.

Fog disabled

2022-09-26_20 01 30

Fog enabled

2022-09-26_20 01 26

Steps to reproduce

  • Switch to the OpenGL driver in the Project Settings.
    • Make sure to start the editor with single-window mode enabled afterwards. This can be done by enabling Single Window Mode in the Editor Settings before changing the driver, or by opening the project in the editor directly with the --single-window command line argument.
  • Add a WorldEnvironment node, a Camera3D node and a MeshInstance3D in front of the camera.
  • Enable fog. Increase density to 0.05 or more to make a visible difference in the scene.

Minimal reproduction project

test_opengl_fog_sky_affect.zip

@ParsleighScumble
Copy link
Contributor

I've been looking into fixing up some of the GLES fog issues because of the fog_sky_affect issue. There are some uniforms in the sky shader but they ain't exactly hooked up to the rendering backend properly. I wanted to pick your brain @Calinou and @clayjohn about what approach the Godot team would like here. Should we pack those guys in a UBO SkySceneData (name in shader) with a struct SkySceneState (mirrored storage on host) to make it more like the Vulkan renderer? Then we would update values in the UBO from RendererEnvironmentStorage in void RasterizerSceneGLES3::_setup_sky. Or should we stick to setting individual uniforms and avoid making a new UBO?

@clayjohn
Copy link
Member

@ParsleighScumble Either approach is fine. Initially I went with the individual uniforms for small things that change frequently, but once you have more than one or two uniforms, it becomes just as fast to pack everything into a UBO that you update every frame.

@ParsleighScumble
Copy link
Contributor

Let's go with a UBO, then. I should have fog sky affect working in GLES pretty soon.

@Calinou
Copy link
Member Author

Calinou commented Jan 1, 2024

I can still reproduce this on 4.3.dev 13a0d6e.

@ParsleighScumble Did you get it working in the end? If so, please open a pull request 🙂
If not, let us know and someone can continue this work.

@ParsleighScumble
Copy link
Contributor

I did get it working but it's a bit of a mess and I didn't get tonemapping working for all background modes. I can post what I have though.

@Calinou
Copy link
Member Author

Calinou commented Jan 3, 2024

I can post what I have though.

Please do 🙂

@Calinou
Copy link
Member Author

Calinou commented Jul 9, 2024

I see in #92019 that fog stops sky affects to be changed, is this the main issue here?

Yes, fog should affect sky rendering to the extent set by the Environment Fog Sky Affect property. That property defaults to 1.0, which means the sky color should match the fog color according to the Camera3D's Z far property (the sky is assumed to be at the same depth as Z far).

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.

3 participants