From d9c8a1e0f6ee1dd7e83f6a229bc0546e4686cb45 Mon Sep 17 00:00:00 2001 From: Leonid Pershin Date: Mon, 10 Aug 2026 22:17:43 +0300 Subject: [PATCH] Remove AccentBar from main menu and associated animation logic. Update menu background shader to enhance starfield effect and adjust aurora band parameters for improved visual quality. --- scenes/game/game.tscn | 88 ++++++++++++++++++++++++++++++++ scenes/ui/main_menu.tscn | 7 --- scripts/ui/main_menu.gd | 9 ---- shaders/menu_background.gdshader | 56 +++++++++++++++----- 4 files changed, 131 insertions(+), 29 deletions(-) create mode 100644 scenes/game/game.tscn diff --git a/scenes/game/game.tscn b/scenes/game/game.tscn new file mode 100644 index 0000000..bdb8b8e --- /dev/null +++ b/scenes/game/game.tscn @@ -0,0 +1,88 @@ +[gd_scene format=3 uid="uid://psbbnpm6g0nc"] + +[ext_resource type="Script" path="res://scripts/game/game_stub.gd" id="1_0sr1o"] +[ext_resource type="PackedScene" uid="uid://cvx4ot7ugyprk" path="res://scenes/ui/pause_menu.tscn" id="1_7h61r"] +[ext_resource type="Theme" uid="uid://c6kkopjj3snag" path="res://themes/main_menu.theme.tres" id="2_0sr1o"] + +[sub_resource type="ProceduralSkyMaterial" id="ProceduralSkyMaterial_kelw5"] +sky_top_color = Color(0.039215688, 0.078431375, 0.15686275, 1) +sky_horizon_color = Color(0.07058824, 0.1882353, 0.2509804, 1) +ground_bottom_color = Color(0.019607844, 0.039215688, 0.07058824, 1) +ground_horizon_color = Color(0.07058824, 0.1882353, 0.2509804, 1) + +[sub_resource type="Sky" id="Sky_lfrn8"] +sky_material = SubResource("ProceduralSkyMaterial_kelw5") + +[sub_resource type="Environment" id="Environment_5i0tg"] +background_mode = 2 +sky = SubResource("Sky_lfrn8") +ambient_light_source = 2 +ambient_light_color = Color(0.2, 0.22, 0.35, 1) +ambient_light_energy = 0.4 + +[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_bdhmt"] +albedo_color = Color(0.07450981, 0.16470589, 0.2, 1) +roughness = 0.95 + +[sub_resource type="PlaneMesh" id="PlaneMesh_87uf6"] +size = Vector2(60, 60) + +[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_2a8rs"] +albedo_color = Color(0.18039216, 0.9019608, 0.77254903, 1) +metallic = 0.1 +roughness = 0.4 + +[sub_resource type="BoxMesh" id="BoxMesh_4j704"] +size = Vector3(2, 2, 2) + +[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_kp23o"] +albedo_color = Color(0.48235294, 0.41960785, 0.9607843, 1) +metallic = 0.1 +roughness = 0.5 + +[sub_resource type="BoxMesh" id="BoxMesh_5jirj"] +size = Vector3(1.2, 3.4, 1.2) + +[node name="Game" type="Node3D" unique_id=1106458558] +script = ExtResource("1_0sr1o") + +[node name="WorldEnvironment" type="WorldEnvironment" parent="." unique_id=1519444008] +environment = SubResource("Environment_5i0tg") + +[node name="Sun" type="DirectionalLight3D" parent="." unique_id=1139733157] +transform = Transform3D(-0.6946583, 0.53457373, -0.48133233, 0, 0.66913056, 0.74314487, 0.7193399, 0.5162317, -0.46481708, 0, 0, 0) +light_color = Color(0.7490196, 0.9019608, 1, 1) +light_energy = 0.9 +shadow_enabled = true + +[node name="Camera3D" type="Camera3D" parent="." unique_id=2037025428] +transform = Transform3D(0.809017, -0.18163563, 0.559017, 0, 0.95105654, 0.309017, -0.58778524, -0.25, 0.7694209, 6.5, 4.2, 8.5) +current = true + +[node name="Ground" type="MeshInstance3D" parent="." unique_id=1318815356] +material_override = SubResource("StandardMaterial3D_bdhmt") +mesh = SubResource("PlaneMesh_87uf6") + +[node name="BoxA" type="MeshInstance3D" parent="." unique_id=1331389928] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0) +material_override = SubResource("StandardMaterial3D_2a8rs") +mesh = SubResource("BoxMesh_4j704") + +[node name="BoxB" type="MeshInstance3D" parent="." unique_id=535287837] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -3.2, 1.7, -2.4) +material_override = SubResource("StandardMaterial3D_kp23o") +mesh = SubResource("BoxMesh_5jirj") + +[node name="PauseMenu" parent="." unique_id=1649378803 instance=ExtResource("1_7h61r")] + +[node name="Hud" type="CanvasLayer" parent="." unique_id=824330719] + +[node name="Hint" type="Label" parent="Hud" unique_id=47403933] +offset_left = 40.0 +offset_top = 40.0 +offset_right = 279.0 +offset_bottom = 63.0 +theme = ExtResource("2_0sr1o") +theme_override_colors/font_color = Color(0.56078434, 0.64705884, 0.7294118, 1) +theme_override_font_sizes/font_size = 18 +text = "Сцена-заглушка. Esc — пауза." diff --git a/scenes/ui/main_menu.tscn b/scenes/ui/main_menu.tscn index bdf24cd..6eef566 100644 --- a/scenes/ui/main_menu.tscn +++ b/scenes/ui/main_menu.tscn @@ -79,13 +79,6 @@ theme_override_constants/shadow_offset_y = 6 theme_override_font_sizes/font_size = 104 text = "G–WORLD" -[node name="AccentBar" type="ColorRect" parent="Content/Column/Header" unique_id=59922137] -custom_minimum_size = Vector2(140, 3) -layout_mode = 2 -size_flags_horizontal = 0 -mouse_filter = 2 -color = Color(0.18039216, 0.9019608, 0.77254903, 1) - [node name="Tagline" type="Label" parent="Content/Column/Header" unique_id=1086917135] layout_mode = 2 theme_override_colors/font_color = Color(0.56078434, 0.64705884, 0.7294118, 1) diff --git a/scripts/ui/main_menu.gd b/scripts/ui/main_menu.gd index 41d6e2f..7a66ec5 100644 --- a/scripts/ui/main_menu.gd +++ b/scripts/ui/main_menu.gd @@ -18,7 +18,6 @@ const HOVER_SCALE := 1.035 @onready var _saves: SaveManagerService = get_node("/root/SaveManager") @onready var _header: Control = $Content/Column/Header -@onready var _accent_bar: ColorRect = $Content/Column/Header/AccentBar @onready var _menu: VBoxContainer = $Content/Column/Menu @onready var _footer: Control = $Footer @onready var _continue_button: Button = $Content/Column/Menu/ContinueButton @@ -43,7 +42,6 @@ func _ready() -> void: var about_back: Button = $AboutOverlay/Center/Card/Body/Actions/AboutBackButton about_back.pressed.connect(_close_about) - _animate_accent_bar() await _play_intro() _focus_first_button() @@ -168,10 +166,3 @@ func _play_intro() -> void: index += 1 await tween.finished - - -func _animate_accent_bar() -> void: - # Медленное «дыхание» акцентной черты под заголовком. - var tween := create_tween().set_loops().set_ease(Tween.EASE_IN_OUT).set_trans(Tween.TRANS_SINE) - tween.tween_property(_accent_bar, "custom_minimum_size:x", 230.0, 2.6) - tween.tween_property(_accent_bar, "custom_minimum_size:x", 140.0, 2.6) diff --git a/shaders/menu_background.gdshader b/shaders/menu_background.gdshader index 3abf7df..1c1e2ea 100644 --- a/shaders/menu_background.gdshader +++ b/shaders/menu_background.gdshader @@ -6,7 +6,7 @@ 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 speed : hint_range(0.0, 0.3) = 0.035; 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; @@ -21,30 +21,60 @@ float hash21(vec2 p) { 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); + + 0.050 * sin(uv.x * freq * 1.6 - t * 0.8) + + 0.018 * sin(uv.x * freq * 2.7 + t * 0.5); float d = abs(uv.y - y); float band = smoothstep(thickness, 0.0, d); return band * band; } +// Звёздное поле. Три независимых хеша на ячейку: положение внутри ячейки, +// базовая яркость и характер мерцания. Без этого звёзды садятся на решётку +// и подмигивают синхронно, волной. +vec3 starfield(vec2 uv) { + vec2 grid = uv * vec2(190.0, 107.0); + vec2 cell = floor(grid); + vec2 local = fract(grid); + + float h1 = hash21(cell); + float h2 = hash21(cell + 17.31); + float h3 = hash21(cell + 41.77); + + float present = step(1.0 - star_amount * 0.045, h1); + + // Смещение внутри ячейки убирает регулярность решётки. + vec2 offset = vec2(h2, h3) * 0.66 + 0.17; + float d = length(local - offset); + + // Ядро плюс мягкий ореол — так звезда читается, не превращаясь в точку. + float radius = mix(0.13, 0.32, h3); + float shape = smoothstep(radius, 0.0, d) + 0.22 * smoothstep(radius * 3.0, 0.0, d); + + // Две несоизмеримые частоты — рисунок мерцания не повторяется на глаз. + float phase = h1 * 62.83; + float flicker = 0.5 + 0.5 * ( + 0.62 * sin(TIME * (0.5 + h3 * 1.8) + phase) + + 0.38 * sin(TIME * (0.31 + h2 * 1.1) * 1.618 + phase * 1.7) + ); + + // У части звёзд мерцание почти незаметно, у части — заметное. + float amplitude = 0.12 + 0.5 * h3; + float brightness = (0.30 + 0.70 * h2) * (1.0 - amplitude + amplitude * flicker); + + vec3 tint = mix(vec3(0.74, 0.84, 1.0), vec3(1.0, 0.93, 0.80), h2); + return tint * present * shape * brightness; +} + 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; + col += aurora_a.rgb * aurora_band(uv, t, 0.34, 4.0, 0.22) * aurora_strength; + col += aurora_b.rgb * aurora_band(uv, t * 0.75 + 2.0, 0.62, 3.0, 0.28) * 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); + col += starfield(uv); // Виньетка по краям кадра. float v = distance(uv, vec2(0.5, 0.5));