56 lines
1.4 KiB
Text
56 lines
1.4 KiB
Text
[gd_resource type="ShaderMaterial" load_steps=6 format=2]
|
|
|
|
[sub_resource type="Shader" id=1]
|
|
code = "shader_type canvas_item;
|
|
|
|
uniform sampler2D noise_sparse;
|
|
uniform sampler2D noise_fine;
|
|
|
|
const float noise_sparse_scale = 0.0007;
|
|
const float noise_fine_scale = 0.003;
|
|
const float warp_clouds_scale = 0.0003;
|
|
const vec2 scroll_dir = vec2(1,0);
|
|
const vec2 blink_scroll = vec2(50.0, 0);
|
|
const float PI = 3.1415;
|
|
|
|
render_mode unshaded;
|
|
|
|
void fragment() {
|
|
float sparse = texture(noise_sparse, FRAGCOORD.xy*noise_sparse_scale).r;
|
|
sparse = ((sparse * sparse) - 0.2) * 1.2;
|
|
float fine = texture(noise_fine, FRAGCOORD.xy*noise_fine_scale).r;
|
|
fine = fine - 0.6;
|
|
if (fine > 0.) {
|
|
fine = fine * 10.0;
|
|
}
|
|
if (fine > 0.3) {
|
|
float fine_blink_fade = texture(noise_sparse, (FRAGCOORD.xy + blink_scroll*TIME)*noise_sparse_scale).r;
|
|
fine = fine - ((fine_blink_fade * fine_blink_fade) - 0.2) * 1.2;
|
|
}
|
|
vec4 clouds = vec4(vec3(0.3, 0.5, 0.7) * sparse, 1.0);
|
|
vec4 stars = vec4(fine);
|
|
|
|
COLOR = clouds + stars;
|
|
}"
|
|
|
|
[sub_resource type="OpenSimplexNoise" id=2]
|
|
period = 2.0
|
|
persistence = 0.6
|
|
lacunarity = 3.0
|
|
|
|
[sub_resource type="NoiseTexture" id=3]
|
|
seamless = true
|
|
noise = SubResource( 2 )
|
|
|
|
[sub_resource type="OpenSimplexNoise" id=4]
|
|
|
|
[sub_resource type="NoiseTexture" id=5]
|
|
width = 1024
|
|
height = 1024
|
|
seamless = true
|
|
noise = SubResource( 4 )
|
|
|
|
[resource]
|
|
shader = SubResource( 1 )
|
|
shader_param/noise_sparse = SubResource( 5 )
|
|
shader_param/noise_fine = SubResource( 3 )
|