Transparent background so that desktop is visible

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Sharon

I want to render my game with a transparent background/no background at all so that my desktop of my computer is visible behind the game, is there a way to make that possible?

Thank you?

Window transparency is usually controlled by the window manager, I don’t know about windows but some linux desktops like lxde don’t support transparency. There are ways to fake transparency, you would likely need a separate script to run along side the game to do this.

Magso | 2019-05-06 18:03

:bust_in_silhouette: Reply From: Calinou

This is possible since Godot 3.1. In the Project Settings, enable the following settings:

  • Display → Window → Per Pixel Transparency → Allowed
  • Display → Window → Per Pixel Transparency → Enabled
  • Display → Window → Per Pixel Transparency → Splash (only if the splash screen requires it)

I tried doing this in my project to no avail. what other steps are necessary to achieve a transparent background?

1urker | 2019-08-30 01:47

You need to call get_tree().get_root().set_transparent_background(true) first

sprite-1 | 2019-09-11 00:04

how would you toggle it off and on with a button in game?

davedabomb | 2020-04-21 18:13

This is awesome!

HeroicNate | 2020-09-12 17:59

To toggle it with an in-game button:

if... # button has been pressed:
		get_tree().get_root().transparent_background = !get_tree().get_root().transparent_background

ClumsyDog | 2021-03-15 05:20

i dont think it works with 3,3

i am getting a black background

code | 2021-05-04 14:44


GNamimates | 2021-06-18 17:24

you will do get a black background when its in fullscreen or the window is covering the entire screen

GNamimates | 2021-06-18 17:24

I have the same issue as @GNamimates. It is not fullscreen and my window is not covering the entire screen

florxb | 2021-09-22 01:45

Well, enabling & allowing the Per Pixel Transparency and running this → get_tree().get_root().set_transparent_background(true)
did the job for me.

shreyk27 | 2022-01-09 17:06