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

Vulkan: viewport flashes white when being resized with volumetric fog enabled #63739

Open
Tracked by #69579
atirut-w opened this issue Jul 31, 2022 · 8 comments
Open
Tracked by #69579

Comments

@atirut-w
Copy link
Contributor

Godot version

v4.0.alpha13.official [59dcddc45]

System information

Fedora Linux 36 (Workstation Edition), Vulkan Clustered, GTX 1660

Issue description

When the viewport is being resized with VL fogs enabled, it flashes white for about a single frame.

(Epilepsy warning)

2022-08-01_01-46-46.mp4

Steps to reproduce

  1. Enable volumetric fog
  2. Resize viewport

Minimal reproduction project

No response

@Calinou
Copy link
Member

Calinou commented Jul 31, 2022

Related to #62794.

Do you also have SSIL enabled in the Environment?

@atirut-w
Copy link
Contributor Author

atirut-w commented Aug 1, 2022

Disabling SSIL doesn't seem to have an effect on the flashing

@clayjohn
Copy link
Member

clayjohn commented Aug 2, 2022

I took a quick look into this, the problem is that, when the viewport is resized, the Fog buffers are deleted and then recreated, but in the meantime the sky/objects are drawn. Since the fog buffers are not initialized yet a plain white texture is used instead leading to the flicker.

The solution will be to update the volumetric fog textures immediately after deletion/creation so there is no blip

@clayjohn clayjohn moved this from To Assess to Todo in 4.x Priority Issues Aug 2, 2022
@Calinou
Copy link
Member

Calinou commented Oct 19, 2022

I can still reproduce this on 4.0.beta3.

Quoting clayjohn from the Godot Contributors Chat:

It is a known issue and we have a few options to resolve it. Its not caused by temporal reprojection, it happens because the volumetric fog buffer gets deleted right before rendering the frame again so the next frame after the clear uses the default clear values.

I think the best option is, instead of clearing the newly allocated fog buffer, we should copy the old fog buffer over and just stretch/squash it to fit, it won't be perfect if size/aspect change a lot, but it should help

The same approach can also be used to fix #56724.

@clayjohn clayjohn modified the milestones: 4.0, 4.x Jan 14, 2023
@Calinou Calinou changed the title Vulkan: viewport flashes white when being resized with VL fog enabled Vulkan: viewport flashes white when being resized with volumetric fog enabled Sep 26, 2023
@viksl
Copy link
Contributor

viksl commented Mar 2, 2024

Still reproducible in 4.3, I just wanted to add that bottom panels chagne the viewport too and with the FileSystem being dockable (and in the future releases possibly other panels soo) and the shortcuts to open/close these panels this is getting quite prominent since the new workflow encourages fluidly opening and closing the panels, I've noticed this testing the PRs and the flashing gets really apparent and annoying ;0.

@Mantle-Core
Copy link

Mantle-Core commented Jul 4, 2024

I can still reproduce this on 4.0.beta3.

Quoting clayjohn from the Godot Contributors Chat:

It is a known issue and we have a few options to resolve it. Its not caused by temporal reprojection, it happens because the volumetric fog buffer gets deleted right before rendering the frame again so the next frame after the clear uses the default clear values.
I think the best option is, instead of clearing the newly allocated fog buffer, we should copy the old fog buffer over and just stretch/squash it to fit, it won't be perfect if size/aspect change a lot, but it should help

The same approach can also be used to fix #56724.

@clayjohn I came down to using a double buffer. Here is my results:

Before

Fog.Before.mp4

After

Fog.After.mp4

I did some testing by just saving the current state and reusing it without these buffers, but that just completely turned off the volume.

As you can see:

@Calinou
Copy link
Member

Calinou commented Jul 4, 2024

This looks great, but doesn't using a double buffer mean there's an additional frame of latency? This might not be a huge deal in most cases given volumetric fog is low-frequency data, but still.

@Mantle-Core
Copy link

I tried a variety of things, but I ended up using the earlier suggestion to fix it. I just reused the previous fog buffer. It looks the same as the "After" video.

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

5 participants