ChocolateBird/shaders/palette_shader.tres

16 lines
386 B
Plaintext

[gd_resource type="Shader" format=2]
[resource]
code = "shader_type canvas_item;
//uniform usampler2D tex;
uniform sampler2D palette: hint_normal;
void fragment() {
//uint color_idx = textureLod(tex, UV, 0.0).r;
uint color_idx = uint(textureLod(TEXTURE, UV, 0.0).r * 255.0);
COLOR = texelFetch(palette, ivec2(int(color_idx), 0), 0);
if (color_idx == uint(0))
COLOR.a = 0.0;
}
"