Skip to content

Background becomes semi-transparent after Alt+Tabbing in Fullscreen with Per-Pixel Transparency enabled #105273

Open
@rushedev

Description

@rushedev

Tested versions

4.3.stable
4.4 stable
4.4.1 stable

System information

Godot v4.4.1.stable - Windows 11 (build 22631) - Multi-window, 2 monitors - Vulkan (Forward+) - dedicated NVIDIA GeForce RTX 4080 SUPER (NVIDIA; 32.0.15.7283) - AMD Ryzen 9 9950X 16-Core Processor (32 threads)

Issue description

I’m not entirely sure if this is a bug or expected behavior, so please let me know if I’ve misunderstood something.

With Per-Pixel Transparency enabled in the Project Settings, I’m creating a game that allows switching between normal fullscreen mode and desktop overlay mode. The functionality works as expected in most cases. However, when the game is in fullscreen mode and I Alt+Tab while keeping the game window visible, the sky becomes semi-transparent. It appears as though the blend mode is set to "Add" or a similar effect, making the sky look incorrect.
This only happens in Forward+, if I change to Compatibility renderer, it works as expected.
With V-Sync disabled, the background becomes semi-transparent after Alt+Tabbing in fullscreen mode.
With V-Sync enabled, the background stays opaque in fullscreen after Alt+Tabbing, but in desktop mode, it fails to become transparent as expected. (Already mentioned here #65487 )

Here’s the weird part: when I record with Streamlabs OBS, the sky looks totally fine, all opaque like it should be. But on my screen after Alt+Tabbing, it’s see-through, so something’s off with the display.

Image
I get the same results if I change from Sky to Clear Color, Custom color in the World Environment. But not in canvas mode.
Also tried D3D12 but no luck.

I’ve read other issues related to semi-transparent windows and Per-Pixel Transparency but couldn’t find any mentioning alt+tabbing. Apologies if this is a duplicate, but I thought it's worth reporting just in case.

Heres the code but probably better to download the MRP project and test for yourself.

func _ready():
	set_fullscreen_mode()

func _input(event):
	if event.is_action_pressed("debug"): #Keybind is T
		if current_state == GameState.FULLSCREEN:
			set_desktop_mode()
		else:
			set_fullscreen_mode()

func set_fullscreen_mode():
	get_window().transparent = false
	DisplayServer.window_set_mode(DisplayServer.WINDOW_MODE_EXCLUSIVE_FULLSCREEN) #Have tried different full screen modes but no luck.
	#DisplayServer.window_set_mode(DisplayServer.WINDOW_MODE_FULLSCREEN) #Sky becomes transparent right away without alt tabbing.
	current_state = GameState.FULLSCREEN

func set_desktop_mode():
	get_window().transparent = true
	DisplayServer.window_set_mode(DisplayServer.WINDOW_MODE_WINDOWED)
	current_state = GameState.DESKTOP

Steps to reproduce

  1. Create a new project.
  2. Enable Per-Pixel Transparency
  3. Disable V-Sync (Transparency wont work if V-Sync is enabled)
  4. Set up a basic scene with default camera and World Environment.
  5. Enable fullscreen
  6. Run project and alt tab to different window.
  7. Notice the game in the background now has a semi transparent background.

Minimal reproduction project (MRP)

Debug keybind to switch screen mode is "T"
transparent_MRP_441.zip

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions