2023-05-21 17:24:37 +02:00
|
|
|
shader_type canvas_item;
|
|
|
|
render_mode skip_vertex_transform;
|
|
|
|
|
|
|
|
void vertex() {
|
|
|
|
VERTEX = (WORLD_MATRIX * (EXTRA_MATRIX * vec4(VERTEX, 0.0, 1.0))).xy;
|
|
|
|
}
|
|
|
|
|
|
|
|
vec3 color_ramp(float h) {
|
|
|
|
if (h < 0.4f) {
|
|
|
|
return vec3(0, 0, 0.6);
|
|
|
|
} else if (h < 0.45f) {
|
|
|
|
return vec3(0, 0, 0.7);
|
|
|
|
} else if (h < 0.5f) {
|
|
|
|
return vec3(0, 0, 1);
|
|
|
|
} else if (h < 0.55){
|
|
|
|
return vec3(0.8, 0.8, 0.1);
|
|
|
|
} else if (h < 0.6){
|
|
|
|
return vec3(0, 0.6, 0);
|
2023-06-11 22:04:22 +02:00
|
|
|
} else if (h < 0.78){
|
2023-05-21 17:24:37 +02:00
|
|
|
return vec3(0, 0.4, 0);
|
|
|
|
} else if (h < 1.0){
|
2023-06-11 22:04:22 +02:00
|
|
|
return vec3(0.5, 0.5, 0.4);
|
2023-05-21 17:24:37 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
return vec3(1.0);
|
|
|
|
}
|
|
|
|
|
|
|
|
vec3 rgbToGrayscale(vec3 color) {
|
|
|
|
return vec3(dot(color.rgb, vec3(0.299, 0.587, 0.144)));
|
|
|
|
}
|
|
|
|
|
|
|
|
float borderFalloff(vec2 uv) {
|
|
|
|
return min(
|
|
|
|
(0.5 - abs(-uv.x + 0.5)) * 2.0,
|
|
|
|
(0.5 - abs(-uv.y + 0.5)) * 2.0);
|
|
|
|
}
|
|
|
|
|
|
|
|
float borderFalloffCircle(vec2 uv) {
|
|
|
|
return (0.5 - length(vec2(uv - vec2(0.5, 0.5)))) * 2.0;
|
|
|
|
}
|
|
|
|
|
|
|
|
void fragment() {
|
|
|
|
vec4 texture_color = texture(TEXTURE, UV);
|
|
|
|
|
|
|
|
|
|
|
|
COLOR.rgb = vec3(abs(UV.x - 0.5) * 2.0);
|
|
|
|
//COLOR.rgb = color_ramp(texture_color.r * borderFalloffCircle(UV) * 1.8);
|
|
|
|
COLOR.rgb = color_ramp(texture_color.r);
|
|
|
|
}
|
|
|
|
|