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 broken on Windows #7544

Open
aevyrie opened this issue Feb 7, 2023 · 29 comments
Open

Window transparency broken on Windows #7544

aevyrie opened this issue Feb 7, 2023 · 29 comments
Labels
A-Rendering Drawing game state to the screen A-Windowing Platform-agnostic interface layer to run your app in C-Docs An addition or correction to our documentation D-Trivial Nice and easy! A great choice to get started with Bevy

Comments

@aevyrie
Copy link
Member

aevyrie commented Feb 7, 2023

Bevy version

main

The transparent_window example appears to have broken.

image

2023-02-07T09:15:10.694725Z  INFO bevy_render::renderer: AdapterInfo { name: "NVIDIA GeForce RTX 3050 Ti Laptop GPU", vendor: 4318, device: 9632, device_type: DiscreteGpu, driver: "NVIDIA", driver_info: "527.56", backend: Vulkan }
2023-02-07T09:15:10.985257Z  INFO bevy_diagnostic::system_information_diagnostics_plugin::internal: SystemInfo { os: "Windows 11 Home", kernel: "22621", cpu: "11th Gen Intel(R) Core(TM) i7-11800H @ 2.30GHz", core_count: "8", memory: "63.7 GiB" }
@aevyrie aevyrie added C-Bug An unexpected or incorrect behavior S-Needs-Triage This issue needs to be labelled A-Rendering Drawing game state to the screen A-Windowing Platform-agnostic interface layer to run your app in and removed S-Needs-Triage This issue needs to be labelled labels Feb 7, 2023
@Aceeri
Copy link
Member

Aceeri commented Feb 8, 2023

Can't seem to repro this myself, going to try updating my drivers. Maybe should try a cargo clean/cargo run --example transparent_window

@minstrel1
Copy link

Same issue occurred on Mac OS on Metal.
SystemInfo { os: "MacOS 12.1 ", kernel: "21.2.0", cpu: "Apple M1", core_count: "8", memory: "8.0 GiB" }

@mockersf
Copy link
Member

This is known, see the docs on https://dev-docs.bevyengine.org/bevy/prelude/struct.Window.html#structfield.transparent

I opened a PR to improve the situation on macOS: #7617

On windows, it should be fixed by latest winit update, but I can't confirm it myself.

@james7132
Copy link
Member

Can confirm that the latest winit update has fixed this on Windows.

@mockersf
Copy link
Member

Doc should be updated to remove mention of issues on windows:

/// ## Platform-specific
/// - iOS / Android / Web: Unsupported.
/// - macOS X: Not working as expected.
/// - Windows 11: Not working as expected
/// macOS X transparent works with winit out of the box, so this issue might be related to: <https://github.com/gfx-rs/wgpu/issues/687>
/// Windows 11 is related to <https://github.com/rust-windowing/winit/issues/2082>

@mockersf mockersf reopened this Feb 27, 2023
@mockersf mockersf added C-Docs An addition or correction to our documentation D-Trivial Nice and easy! A great choice to get started with Bevy and removed C-Bug An unexpected or incorrect behavior labels Feb 27, 2023
@bors bors bot closed this as completed in aba8e81 Feb 27, 2023
@aevyrie
Copy link
Member Author

aevyrie commented Mar 6, 2023

This appears to be broken on main again. I've tried a cargo clean and running in release with no luck.

@aevyrie aevyrie reopened this Mar 6, 2023
Shfty pushed a commit to shfty-rust/bevy that referenced this issue Mar 19, 2023
…ine#7832)

# Objective
Fix bevyengine#7544. Update docs for `Window::transparent` regarding Windows 11 platform support. Following the update to winit 0.28, this has been fixed.

## Solution
Remove the mention in the docs.
@morfert
Copy link

morfert commented Jun 14, 2023

transparent_window example not working for me either.
image

cargo run --example transparent_window
    Finished dev [unoptimized + debuginfo] target(s) in 0.42s
     Running `target\debug\examples\transparent_window.exe`
2023-06-14T07:43:02.479588Z  INFO bevy_winit::system: Creating new window "Bevy App" (0v0)
2023-06-14T07:43:02.769532Z  INFO bevy_render::renderer: AdapterInfo { name: "NVIDIA GeForce GTX 1660 Ti", vendor: 4318, device: 8593, device_type: DiscreteGpu, driver: "NVIDIA", driver_info: "528.79", backend: Vulkan }
2023-06-14T07:43:04.046657Z  INFO bevy_diagnostic::system_information_diagnostics_plugin::internal: SystemInfo { os: "Windows 10 Home", kernel: "19045", cpu:
"Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz", core_count: "6", memory: "15.8 GiB" }

@Aceeri
Copy link
Member

Aceeri commented Jun 16, 2023

@aevyrie @morfert Could you try running the winit example here? https://github.com/rust-windowing/winit/blob/master/examples/transparent.rs

Will see if I can repro again this week.

@morfert
Copy link

morfert commented Jun 16, 2023

I cloned winit and ran cargo run --example transprent but the window was not transparent.
image
This may be a winit problem.

@Aceeri
Copy link
Member

Aceeri commented Jun 16, 2023

Investigating a bit and it seems like that might just be an issue with their example not drawing anything?

rust-windowing/winit#2502

@SecretPocketCat
Copy link
Contributor

This might be a red herring, but blur and similar decorators were broken in the tauri-adjacent crate on Win 11 22H2
tauri-apps/window-vibrancy#45

@SecretPocketCat
Copy link
Contributor

This might be a red herring, but blur and similar decorators were broken in the tauri-adjacent crate on Win 11 22H2 tauri-apps/window-vibrancy#45

My bad, the bevy example is actually fine on Win 11 22H2.

@morfert
Copy link

morfert commented Jun 22, 2023

Yeah, winit is probably fine I tried drawing something.

Transparent

With:

        WindowBuilder::new()
            .with_decorations(false)
            .with_transparent(true)
            .with_inner_size(size)
            .with_min_inner_size(size)
            .build(&event_loop)
            .unwrap()

Result:
image

Not transparent

With:

        WindowBuilder::new()
            .with_title("Hello Pixels")
            .with_inner_size(size)
            .with_min_inner_size(size)
            .build(&event_loop)
            .unwrap()

Result:
image

Conclusion

As long as something is drawn, winit seems to properly become transparent.

Addendum

The Not transparent test is the unmodified minimal winit example from pixels.

@stefnotch
Copy link

@morfert

Pixels might not be the best library to test this, because of parasyte/pixels#370
That leads to it being either "fully transparent" or "fully opaque".

transparent-pixels-winit.zip

@morfert
Copy link

morfert commented Aug 30, 2023

Using the following code:

    let window = WindowBuilder::new()
        .with_title("A simple window")
        .with_transparent(true)
        .build(&event_loop)
        .expect("Builing window failed");

    let instance = wgpu::Instance::default();

    let surface = unsafe { instance.create_surface(&window) }.expect("Could not create surface");

    for ad in instance.enumerate_adapters(wgpu::Backends::all()) {
        info!(
            "Adapter : {:?}\n Supported Alpha : {:?}",
            ad.get_info(),
            surface.get_capabilities(&ad).alpha_modes
        );
    }

I enumerate to see all supported alpha_modes for all adapters on my laptop. The results are as follows:

2023-08-30T08:05:50.081235Z  INFO gapoo:
 Adapter : AdapterInfo { name: "NVIDIA GeForce GTX 1660 Ti", vendor: 4318, device: 8593, device_type: DiscreteGpu, driver: "NVIDIA", driver_info: "532.09", backend: Vulkan }
 Supported Alpha : [Opaque]
    at src\main.rs:29

2023-08-30T08:05:50.081668Z  INFO gapoo:
 Adapter : AdapterInfo { name: "Intel(R) UHD Graphics 630", vendor: 32902, device: 16027, device_type: IntegratedGpu, driver: "Intel Corporation", driver_info: "Intel driver", backend: Vulkan }
 Supported Alpha : [Opaque, Inherit]
    at src\main.rs:29

2023-08-30T08:05:50.081924Z  INFO gapoo:
 Adapter : AdapterInfo { name: "NVIDIA GeForce GTX 1660 Ti", vendor: 4318, device: 8593, device_type: DiscreteGpu, driver: "", driver_info: "", backend: Dx12 }
 Supported Alpha : [Opaque]
    at src\main.rs:29

2023-08-30T08:05:50.114292Z  INFO gapoo:
 Adapter : AdapterInfo { name: "Intel(R) UHD Graphics 630", vendor: 32902, device: 16027, device_type: IntegratedGpu, driver: "", driver_info: "", backend: Dx12 }
 Supported Alpha : [Opaque]
    at src\main.rs:29

2023-08-30T08:05:50.123944Z  INFO gapoo:
 Adapter : AdapterInfo { name: "Microsoft Basic Render Driver", vendor: 5140, device: 140, device_type: Cpu, driver: "", driver_info: "", backend: Dx12 }
 Supported Alpha : [Opaque]
    at src\main.rs:29

Only Opaque and Inherit are available. This might be the problem.

@CoryRobertson
Copy link

I also have transparency not working as well, are there any active workarounds?

@edraze
Copy link

edraze commented Mar 20, 2024

Hi, are there any updates on this problem?
Looks like transparency still not working(#10929), even with winit latest versions.

@bradmesserle
Copy link

How do we find gpu's that support PostMultiplied Apha Mode?

@lunarcleint
Copy link

Has they're been any update on this? transparency is still not working and now I'm noticing the examples just missing from the winit repo

@bradmesserle
Copy link

bradmesserle commented May 24, 2024 via email

@KernelKrusha
Copy link

KernelKrusha commented Jun 26, 2024

I also have this problem with AMD Radeon 680M on Win 11, only getting Opaque in the list of supported alpha modes. Not sure if that is related or not, but the transparency example on master does not work.

@lunarcleint
Copy link

lunarcleint commented Jun 27, 2024 via email

@bradmesserle
Copy link

bradmesserle commented Jun 27, 2024 via email

@bradmesserle
Copy link

bradmesserle commented Jun 27, 2024 via email

@bradmesserle
Copy link

bradmesserle commented Jun 27, 2024 via email

@bradmesserle
Copy link

bradmesserle commented Jun 27, 2024 via email

@Arrekin
Copy link

Arrekin commented Aug 2, 2024

The example from https://github.com/bevyengine/bevy/blob/release-0.14.0/examples/window/transparent_window.rs does not work for me. I'm getting a black background.

Bevy 0.14, Windows 10, Vulkan, [Opaque]

SystemInfo { os: "Windows 10 Pro", kernel: "19045", cpu: "Intel(R) Core(TM) i7-6800K CPU @ 3.40GHz", core_count: "6", memory: "15.9 GiB" }
AdapterInfo { name: "NVIDIA GeForce GTX 1080", vendor: 4318, device: 7040, device_type: DiscreteGpu, driver: "NVIDIA", driver_info: "556.12", backend: Vulkan }

@iamthuypham
Copy link

I had the same problem. I have to update NVIDIA graphic card version to get it working.

Before:
NVIDIA RTX 3500 Ada Generation v538.18

After:
NVIDIA RTX 3500 Ada Generation v552.86

@Arrekin
Copy link

Arrekin commented Sep 17, 2024

561.09 for NVIDIA GeForce GTX 1080 - the newest available driver - still doesn't work. The background is still black 😞

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Rendering Drawing game state to the screen A-Windowing Platform-agnostic interface layer to run your app in C-Docs An addition or correction to our documentation D-Trivial Nice and easy! A great choice to get started with Bevy
Projects
None yet
Development

Successfully merging a pull request may close this issue.