ShaderMaterial in Godot 4.2 doesn't apply to tilemap/tileset

58 views Asked by At

I'm doing a project on procedural tiling in Godot 4.2 and I ran into a problem that the ShaderMaterial is not applied to the tileset

Here's my code (basically the shader just needs to remove the white on each tile):

shader_type canvas_item;

uniform vec4 target_color : source_color = vec4(1.0, 1.0, 1.0, 1.0);

void fragment() {
    vec4 current_pixel = texture(TEXTURE, SCREEN_UV);
    if (length(current_pixel.rgb - target_color.rgb) < 0.001) {
        discard;
    }
    COLOR = current_pixel;
}

[picture of a problem] https://i.stack.imgur.com/4niFD.png

0

There are 0 answers