first commit
This commit is contained in:
@@ -0,0 +1,54 @@
|
||||
shader_type canvas_item;
|
||||
|
||||
// Анимированный фон главного меню: градиент + полярное сияние + звёзды + виньетка.
|
||||
|
||||
uniform vec4 color_top : source_color = vec4(0.035, 0.043, 0.098, 1.0);
|
||||
uniform vec4 color_bottom : source_color = vec4(0.020, 0.106, 0.133, 1.0);
|
||||
uniform vec4 aurora_a : source_color = vec4(0.180, 0.850, 0.760, 1.0);
|
||||
uniform vec4 aurora_b : source_color = vec4(0.470, 0.360, 0.960, 1.0);
|
||||
uniform float speed : hint_range(0.0, 1.0) = 0.12;
|
||||
uniform float aurora_strength : hint_range(0.0, 2.0) = 0.55;
|
||||
uniform float star_amount : hint_range(0.0, 1.0) = 0.45;
|
||||
uniform float vignette_strength : hint_range(0.0, 1.0) = 0.65;
|
||||
|
||||
float hash21(vec2 p) {
|
||||
p = fract(p * vec2(123.34, 456.21));
|
||||
p += dot(p, p + 45.32);
|
||||
return fract(p.x * p.y);
|
||||
}
|
||||
|
||||
// Мягкая волнистая полоса «сияния» на высоте center.
|
||||
float aurora_band(vec2 uv, float t, float center, float freq, float thickness) {
|
||||
float y = center
|
||||
+ 0.090 * sin(uv.x * freq + t)
|
||||
+ 0.055 * sin(uv.x * freq * 1.7 - t * 1.3)
|
||||
+ 0.025 * sin(uv.x * freq * 3.1 + t * 0.7);
|
||||
float d = abs(uv.y - y);
|
||||
float band = smoothstep(thickness, 0.0, d);
|
||||
return band * band;
|
||||
}
|
||||
|
||||
void fragment() {
|
||||
vec2 uv = UV;
|
||||
float t = TIME * speed * 6.28318;
|
||||
|
||||
vec3 col = mix(color_top.rgb, color_bottom.rgb, smoothstep(0.0, 1.0, uv.y));
|
||||
|
||||
col += aurora_a.rgb * aurora_band(uv, t, 0.34, 4.0, 0.20) * aurora_strength;
|
||||
col += aurora_b.rgb * aurora_band(uv, t * 0.75 + 2.0, 0.62, 3.0, 0.26) * aurora_strength * 0.75;
|
||||
|
||||
// Звёздное поле: разреженная сетка с мерцанием.
|
||||
vec2 gv = uv * vec2(240.0, 135.0);
|
||||
vec2 cell = floor(gv);
|
||||
float h = hash21(cell);
|
||||
float star = step(1.0 - star_amount * 0.02, h);
|
||||
float twinkle = 0.45 + 0.55 * sin(TIME * (1.2 + h * 5.0) + h * 30.0);
|
||||
float d = length(fract(gv) - 0.5);
|
||||
col += vec3(0.85, 0.92, 1.0) * star * twinkle * smoothstep(0.42, 0.0, d);
|
||||
|
||||
// Виньетка по краям кадра.
|
||||
float v = distance(uv, vec2(0.5, 0.5));
|
||||
col *= 1.0 - smoothstep(0.32, 0.95, v) * vignette_strength;
|
||||
|
||||
COLOR = vec4(col, 1.0);
|
||||
}
|
||||
Reference in New Issue
Block a user