21 lines
588 B
Plaintext
21 lines
588 B
Plaintext
|
|
shader_type canvas_item;
|
||
|
|
|
||
|
|
uniform sampler2D gradient_texture;
|
||
|
|
|
||
|
|
void vertex() {
|
||
|
|
// Called for every vertex the material is visible on.
|
||
|
|
}
|
||
|
|
|
||
|
|
void fragment() {
|
||
|
|
vec4 existing_color = texture(TEXTURE, UV);
|
||
|
|
float grayscale_value = (existing_color.r + existing_color.g + existing_color.b)/3.0;
|
||
|
|
vec4 new_color = texture(gradient_texture, vec2(grayscale_value));
|
||
|
|
COLOR.rgb = new_color.rgb;
|
||
|
|
COLOR.a = existing_color.a;
|
||
|
|
}
|
||
|
|
|
||
|
|
//void light() {
|
||
|
|
// // Called for every pixel for every light affecting the CanvasItem.
|
||
|
|
// // Uncomment to replace the default light processing function with this one.
|
||
|
|
//}
|