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

Window transparency does not work #81626

Closed
Drachenbauer opened this issue Sep 13, 2023 · 8 comments
Closed

Window transparency does not work #81626

Drachenbauer opened this issue Sep 13, 2023 · 8 comments

Comments

@Drachenbauer
Copy link

Drachenbauer commented Sep 13, 2023

Godot version

v4.0.stable.official [92bee43]

System information

Windows 11 v4.0.stable.official

Issue description

The window of the project run test becomes black instead of transparent with these transparency-settings (only visible in advanced project settings):
Project-Settings -> Window -> Size -> Transparent = on
Project-Settings -> Window -> per pixel Transparency -> Allowed = on
Project-Settings -> Rendering -> Environment -> Default Clear Color = 0,0,0,0 (fully transparent)
Project-Settings -> Rendering -> Viewport -> Transparent Background = on

Steps to reproduce

Start a new project, open the project-settings and set the window to fullscreen, not resizable and no border and set the transparency settings from above as shown there.

Minimal reproduction project

N/A

@Drachenbauer
Copy link
Author

Drachenbauer commented Sep 13, 2023

It still appears in Godot v4.1.1.stable.official [bd6af8e]
And with get_viewport().mouse_passthrough_polygon set in a script, it shows a black patch in shape of the polygon and hides scene-objects(tested 2d-stuff), which are outside of the polygon.

@Calinou
Copy link
Member

Calinou commented Sep 13, 2023

Does it work if you switch the rendering method to Compatibility in the top-right corner of the editor? Vulkan window transparency isn't as well-supported as with OpenGL.

Also, are you using hybrid graphics (NVIDIA Optimus)? Window transparency isn't supported with those if the project is running on the dedicated GPU, which is the case by default when using Vulkan.

@Drachenbauer
Copy link
Author

with Compatibility the black disappears.

@Calinou
Copy link
Member

Calinou commented Sep 16, 2023

with Compatibility the black disappears.

Which graphics card model are you using?

@0x0ACB
Copy link
Contributor

0x0ACB commented Nov 24, 2023

There seems to be some issue with the latest nvidia and amd drivers. Prior to the september driver updates transparency with vulkan worked fine. Now only OpenGL is working on my dedicated GPU. However, if I switch to my iGPU Vulkan transparency is working.

I noticed that on my iGPU it does not matter if I set

get_tree().get_root().set_transparent_background(true)

to true or false. As long as I have per pixel transparency enabled and

DisplayServer.window_set_flag(DisplayServer.WINDOW_FLAG_TRANSPARENT, true)

set to true the window is transparent.

I inspected the frames with Frame Doctor and the swapchain image always has a transparent background irrespective of set_transparent_background. For some reason the background color changes between black and grey though. Also reverting WINDOW_FLAG_TRANSPARENT to false does not make the background opaque again.

The only difference I could find so far is that my nvidia card only supports VK_COMPOSITE_ALPHA_OPAQUE_BIT_KHR while the iGPU also supports VK_COMPOSITE_ALPHA_INHERIT_BIT_KHR however this is true with both the latest driver and the nvidia 531 driver where transparency still works

@0x0ACB
Copy link
Contributor

0x0ACB commented Nov 24, 2023

I did some further testing compiling the engine myself. Forcing

/*compositeAlpha*/ compositeAlpha,
to
VK_COMPOSITE_ALPHA_OPAQUE_BIT_KHR or VK_COMPOSITE_ALPHA_INHERIT_BIT_KHR has no change on transparency on both the iGPU and my dedicated GPU. So this doesn't seem to be the culprit.

Also while I can only vouch for the tests I did myself. I have reports from over 100 users that observed the same issue. Reverting drivers to pre september or switching to OpenGL did resolve this (for most of them at least).

@Calinou
Copy link
Member

Calinou commented Nov 24, 2023

Closing in favor of #76167, as this is likely the same underlying issue.

@0x0ACB I suggest you post your findings in the linked issue 🙂

@0x0ACB
Copy link
Contributor

0x0ACB commented Nov 24, 2023

I have added it to the other issue. However I do not think this is necessarily related. I think the hybrid GPU issue is more of a Windows DWM problem since the transparency issues were fixed if you ran godot on the same GPU that was running the window manager.

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

3 participants