89 lines
1.9 KiB
Plaintext
89 lines
1.9 KiB
Plaintext
[gd_scene load_steps=5 format=2]
|
|
|
|
[sub_resource type="Shader" id=1]
|
|
code = "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);
|
|
} else if (h < 0.68){
|
|
return vec3(0, 0.4, 0);
|
|
} else if (h <= 0.78){
|
|
return vec3(0.6, 0.6, 0.6);
|
|
} else if (h < 1.0){
|
|
return vec3(0.8, 0.8, 0.8);
|
|
}
|
|
|
|
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 * borderFalloff(UV) * 1.8);
|
|
}
|
|
|
|
"
|
|
|
|
[sub_resource type="ShaderMaterial" id=2]
|
|
shader = SubResource( 1 )
|
|
|
|
[sub_resource type="OpenSimplexNoise" id=3]
|
|
seed = 57
|
|
octaves = 5
|
|
period = 20.0
|
|
persistence = 0.2
|
|
lacunarity = 4.0
|
|
|
|
[sub_resource type="NoiseTexture" id=4]
|
|
width = 128
|
|
height = 128
|
|
seamless = true
|
|
noise = SubResource( 3 )
|
|
noise_offset = Vector2( 2.632, 0 )
|
|
|
|
[node name="Node2D" type="Node2D"]
|
|
|
|
[node name="GridContainer" type="GridContainer" parent="."]
|
|
margin_right = 861.0
|
|
margin_bottom = 595.0
|
|
|
|
[node name="TextureRect" type="TextureRect" parent="GridContainer"]
|
|
material = SubResource( 2 )
|
|
margin_right = 861.0
|
|
margin_bottom = 595.0
|
|
size_flags_horizontal = 3
|
|
size_flags_vertical = 3
|
|
texture = SubResource( 4 )
|
|
expand = true
|