Godot: Per Pixel Transparency in html5

Created on 6 Feb 2020  路  5Comments  路  Source: godotengine/godot

Godot version: 3.2 GLES2

OS/device including version: Linux 5.4.14-2-MANJARO

Issue description:
Hi

Per Pixel Transparency works in html5 export ?

get_tree().get_root().set_transparent_background(true) in my _ready
Display/Window/Per Pixel Transparency/Allowed => true
Display/Window/Per Pixel Transparency/Enabled => true

On export linux, everythings is good and transparent but in html5 i got a black background !
I change the export template to have background-color: transparent; in body html and #canvas

thx

enhancement html5 porting

Most helpful comment

Looks like something like this could work! 5d1cbc887bf94fcba714635e932fb61e44aec215

test export, html body blue background is visible
TransparentCanvasExport.zip

Not sure about the EmscriptenWebGLContextAttributes premultipliedAlpha option,
also I guess the alpha option should be setted only if required in the project preferences

All 5 comments

Per pixel transparency is implemented on Linux, macOS and Windows only.

Display/Window properties do nothing on other platforms. set_transparent_background disables background rendering.

Looks like something like this could work! 5d1cbc887bf94fcba714635e932fb61e44aec215

test export, html body blue background is visible
TransparentCanvasExport.zip

Not sure about the EmscriptenWebGLContextAttributes premultipliedAlpha option,
also I guess the alpha option should be setted only if required in the project preferences

@muiroc i have to rebuild godot to get this bug fix ?

@evandikt Yes, you need to download the Godot repository with @muiroc's commit then recompile the HTML5 export template by following the instructions in Compiling for the Web.

Once you've finished compiling, you can specify the generated ZIP as a custom (release or debug) export template in your project's HTML5 export preset.

@evandikt meanwhile here's the debug-opt export template built from #36075 if you need it
godot.javascript.opt.debug.zip

Was this page helpful?
0 / 5 - 0 ratings