masking shader

credits to scarm for finding it, thanks m8

Shader code
shader_type canvas_item;

void fragment(){
    COLOR = texture(SCREEN_TEXTURE, SCREEN_UV);
    COLOR.a = texture(TEXTURE, UV).a;
}
The shader code and all code snippets in this post are under MIT license and can be used freely. Images and videos, and assets depicted in those, do not fall under this license. For more info, see our License terms.

More from snesmocha

impact shader

background shader

more shaders converted (enviroment)

Related shaders

Stencil / Masking in 3D

Texture Masking

far distance water shader (sea shader)

Subscribe
Notify of
guest

2 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
Marcelo
Marcelo
1 year ago

How can I do update for this shader on Godot 4.1?

pappy
pappy
1 month ago
Reply to  Marcelo

shader_type canvas_item;

// Declare screen texture with proper hint
uniform sampler2D SCREEN_TEXTURE : hint_screen_texture;

void fragment() {
  // Sample screen texture and current texture
  COLOR = texture(SCREEN_TEXTURE, SCREEN_UV);
  COLOR.a = texture(TEXTURE, UV).a;
}