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

Per Pixel Transparency is broken when using borderless windows and fullscreen in godot 3.2.3 #46958

Closed
bububirb opened this issue Mar 13, 2021 · 6 comments

Comments

@bububirb
Copy link

Operating System:
Windows 7 Pro SP1.

Godot Version:
Godot 3.2.3 stable.

Issue:
Per Pixel Transparency replaces transparency with black when using Borderless windows and Maximized Mode (or Fullscreen).
On Godot 3.2.2 stable the window works fine only when exporting.
However, on Godot 3.2.3 stable the window replaces transparency with black.
When running the project from the Godot Editor the window is always broken.

Steps to reproduce:
Go to Project Settings and set the window to be borderless and enable Per Pixel Transparency.
Make a new scene and attach a script to it.
Add in the ready function:
get_tree().get_root().set_transparent_background(true)
OS.window_maximized = true
(Change it to false to see the normal condition)
Export the project in Godot 3.2.3 stable and Godot 3.2.2 stable.

Minimal Project:
window_transparency_bug.zip

Exported project (Godot 3.2.2 stable) with the expected behavior:
window_transparency_bug_godot_3.2.2.zip

@purgeme
Copy link

purgeme commented Mar 14, 2021

Godo-3.2.3 had this issue with windows 10 as well.
Building from master branch doesn't seem to have the same problem so I think it might be fixed.

@bruvzg
Copy link
Member

bruvzg commented Mar 14, 2021

This is expected, in the full screen or borderless full screen (borderless + maximized) mode per-pixel transparency may or may not work depending on GPU driver and OS. When the full screen window is detected, OS can stop rendering other windows.

As a workaround, you can set the window size to be a few pixels smaller than a screen size.

Building from master branch doesn't seem to have the same problem so I think it might be fixed.

Currently, there's no per-pixel transparency support in master at all.

@bububirb
Copy link
Author

bububirb commented Mar 14, 2021

Is this problem already fixed in Godot 3.2.4?

Godot 3.2.2 doesn't seem to have a problem when exporting the project.

Is there a way to make a borderless window maximized without being in Fullscreen mode (eg. Showing the taskbar like a normal window would)?

In my case, I have all the window components (Close, Minimize and Maximize buttons) inside the window to be consistent across platforms and some areas in the program are partially transparent.

Making the window slightly smaller is a good workaround for this case but it would be great if there is a way to make the window behave like a normal one, covering everything except the taskbar.

@bububirb
Copy link
Author

My GPU is a GeForce GTX 1050 Ti and my driver is currently version 456.38.

@Calinou
Copy link
Member

Calinou commented Mar 14, 2021

Is there a way to make a borderless window maximized without being in Fullscreen mode (eg. Showing the taskbar like a normal window would)?

Enable borderless window in the Project Settings, disable fullscreen and set OS.window_maximized = true in a script.

Note that we don't recommend implementing client-side decorations in Godot as there is no way to implement custom draggable areas yet. Moving the window yourself when the user drags the title bar will lead to desyncs and issues on multi-monitor setups (on top of not being able to benefit from window managers' tiling features).

@Calinou
Copy link
Member

Calinou commented Apr 30, 2022

Closing in favor of #60665, as this is the same underlying cause. The fact that per-pixel transparency doesn't work in this situation is a Windows limitation, so it can't be fixed as long as exclusive fullscreen is used.

This happens because Godot 3.x actually uses exclusive fullscreen if the window size matches the screen size (even if the Borderless project setting is enabled). You can work this around by setting the window size to be one pixel smaller on one of the axes.

This was remedied in Godot 4.0alpha by adding separate borderless window and exclusive fullscreen modes. Unfortunately, it's not easy to fix in Godot 3.x which doesn't use the backwards-incompatible DisplayServer abstraction.

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