-
-
Notifications
You must be signed in to change notification settings - Fork 22k
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
Re-enable per-pixel transparency support on Linux, macOS, and Windows. #65283
Conversation
Would this help anything listed in this issue #63675? |
Wanted to repost that @you-win depends on this transparent desktop windows feature for https://github.com/virtual-puppet-project/vpuppr |
… (for Vulkan and OpenGL rendering drivers).
29f0f3a
to
57829b7
Compare
This comment was marked as outdated.
This comment was marked as outdated.
Actually, it's completely unrelated, so ignore my previous comment, I was looking at a wrong tab. This is for enabling semi-transparent windows, it's not affecting rendering in any way. |
Thanks! |
I tested the example project, turned out it had the transparent_background flag disabled and made me think the movie maker was working wrong, but it indeed recorded with transparent background. However the window itself does not show with transparent background and renders the skybox when running, this behavior is quite unexpected EDIT: i am updating my gpu drivers right now, uldate later |
Which operating system are you using? On Linux, you must have composting enabled in your window manager for transparency to be visible. This is the case by default on most desktop environments, but not always – especially on "lightweight" ones such as Xfce or LXQt. |
I just updated my nvidia drivers to confirm it is not a driver issue, the problem still persists |
I wonder if the fact this is hybrid graphics (NVIDIA Optimus) causes an issue with per-pixel transparency. Try updating the Intel integrated graphics' drivers as well (from Intel, not your laptop OEM or Windows Update). |
This is because Godot uses premultiplied alpha for transparent windows. Fully transparent pixels use additive blending, fully opaque pixels use "mix" blending. This means that fully transparent non-black pixels will be visible, but with additive blending. Premultiplied alpha should be preferred over straight alpha, as it allows for antialiased borders to look correct. (You can check this by having an unshaded white cube in a transparent window, then moving this transparent window on a white background. Make sure to enable MSAA to some degree.) |
Thank you @Calinou, that solved it for me, 1 material in the scene was "corrupting" everything else by having subsurface scattering turned on I think this is a bug? if not could we add a warning? "SSS causes scene to use additive blending with per-pixel transparency enabled" |
@GK-GreyGhost The SSS issue may be a bug. Please open an issue with a minimal reproduction project attached. |
@Calinou copy that, I will shortly, thanks! |
Seems like new Vulkan drivers have support for transparency, so it can be re-enabled.
So far I have tested it on Windows (with NVIDIA RTX 2070 Super), Linux (Fedora 36, NVIDIA RTX 2070 Super) and M1 mac.
To use:
display/window/per_pixel_transparency/allowed
in the project settings.get_viewport().transparent_bg = true
.DisplayServer.window_set_flag(DisplayServer.WINDOW_FLAG_TRANSPARENT, true, window_id)
.Transparency for the splash screen will probably require some additional changes.
Fixes #50626