Last active
November 21, 2021 19:55
-
-
Save deakcor/8aaeaabe28aff9e43430cf04143420bf to your computer and use it in GitHub Desktop.
Fix transparent viewport for Godot Engine
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 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