Skip to content

Instantly share code, notes, and snippets.

@deakcor
Last active November 21, 2021 19:55
Show Gist options
  • Save deakcor/8aaeaabe28aff9e43430cf04143420bf to your computer and use it in GitHub Desktop.
Save deakcor/8aaeaabe28aff9e43430cf04143420bf to your computer and use it in GitHub Desktop.
Fix transparent viewport for Godot Engine
/**
* Fix Godot transparent viewport.
* License: CC0
* https://creativecommons.org/publicdomain/zero/1.0/
*/
shader_type canvas_item;
void fragment(){
vec4 color = texture(TEXTURE,UV);
if (color.a!=0.0){
vec3 color_fix = color.rgb/color.a; //Must be applied each time you get texture(), one row fix: color.rgb/=color.a
}
COLOR = vec4(color_fix,color.a);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment