Created
November 12, 2018 12:14
-
-
Save kzerot/411233706bce08b236cdc41683885a3b to your computer and use it in GitHub Desktop.
Godot. Very simple mask shader for 2d.
This file contains hidden or 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
shader_type canvas_item; | |
uniform sampler2D mask; | |
void fragment(){ | |
vec4 col = texture(mask, UV); | |
if(col.a == 0.0){ | |
COLOR = col; | |
} | |
else if (col.a > .99){ | |
COLOR = texture(TEXTURE, UV); | |
} | |
else{ | |
vec4 col2= texture(TEXTURE, UV); | |
col2.a = min(col.a, col2.a); | |
COLOR = col2; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment