0 votes

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?

in Engine by (14 points)
edited by

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.

1 Answer

+4 votes

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)
by (10,980 points)

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

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

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

This is awesome!

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

i dont think it works with 3,3

i am getting a black background


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

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

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.