Skip to content

Instantly share code, notes, and snippets.

@kzerot
Created November 12, 2018 12:14
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kzerot/411233706bce08b236cdc41683885a3b to your computer and use it in GitHub Desktop.
Save kzerot/411233706bce08b236cdc41683885a3b to your computer and use it in GitHub Desktop.
Godot. Very simple mask shader for 2d.
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