diff --git a/project.godot b/project.godot index f17faf5..629151e 100644 --- a/project.godot +++ b/project.godot @@ -11,6 +11,7 @@ config_version=5 [application] config/name="simple starfield" +config/tags=PackedStringArray("experiment", "git_managed", "project_elysium") config/features=PackedStringArray("4.5", "Forward Plus") config/icon="res://icon.svg" diff --git a/src/starfield_texture.gdshader b/src/mono-color-starfield/starfield_texture.gdshader similarity index 100% rename from src/starfield_texture.gdshader rename to src/mono-color-starfield/starfield_texture.gdshader diff --git a/src/starfield_texture.gdshader.uid b/src/mono-color-starfield/starfield_texture.gdshader.uid similarity index 100% rename from src/starfield_texture.gdshader.uid rename to src/mono-color-starfield/starfield_texture.gdshader.uid diff --git a/src/starfield_texture.tscn b/src/mono-color-starfield/starfield_texture.tscn similarity index 97% rename from src/starfield_texture.tscn rename to src/mono-color-starfield/starfield_texture.tscn index 8e30887..d709ee2 100644 --- a/src/starfield_texture.tscn +++ b/src/mono-color-starfield/starfield_texture.tscn @@ -1,6 +1,6 @@ [gd_scene load_steps=9 format=3 uid="uid://bcvjq6tdfp34q"] -[ext_resource type="Shader" uid="uid://bm2uwshby7iak" path="res://src/starfield_texture.gdshader" id="1_40a2p"] +[ext_resource type="Shader" uid="uid://bm2uwshby7iak" path="res://src/mono-color-starfield/starfield_texture.gdshader" id="1_40a2p"] [sub_resource type="Shader" id="Shader_40a2p"] code = "shader_type canvas_item; diff --git a/src/multi-color-starfield/mc_fast_noise.tres b/src/multi-color-starfield/mc_fast_noise.tres new file mode 100644 index 0000000..e164b3a --- /dev/null +++ b/src/multi-color-starfield/mc_fast_noise.tres @@ -0,0 +1,5 @@ +[gd_resource type="FastNoiseLite" format=3 uid="uid://w4lmtnx0twag"] + +[resource] +seed = 250 +frequency = 0.4687 diff --git a/src/multi-color-starfield/mc_starfield.gdshader b/src/multi-color-starfield/mc_starfield.gdshader new file mode 100644 index 0000000..68742c6 --- /dev/null +++ b/src/multi-color-starfield/mc_starfield.gdshader @@ -0,0 +1,30 @@ +shader_type canvas_item; + +uniform vec2 resolution = vec2(1270, 720); +uniform sampler2D noise_texture: filter_nearest, repeat_enable; +uniform float density: hint_range(1.0, 100.0, 0.1) = 20.0; +uniform float speed_x: hint_range(-100.0, 100, 0.1) = 0.005; +uniform float speed_y: hint_range(-100.0, 100, 0.1) = 0.0; +uniform float layers: hint_range(1, 10, 1) = 5; +uniform vec4 color_1: source_color; +uniform vec4 color_2: source_color; +uniform vec4 color_3: source_color; +uniform vec4 color_4: source_color; + +float rand(vec2 uv) { + return fract(sin(dot(uv.xy, vec2(12.9898,78.233))) * 43758.5453123); +} + +void fragment() { + vec2 uv = UV; + uv.x *= resolution.x / resolution.y; + vec2 speed = TIME * vec2(speed_x, speed_y); + float stars = 0.0; + for(float i = 0.0; i < layers; i++){ + float shift = i * 0.3; + float brightness = 1.0 - i * 0.2; + stars += step(0.2, pow(texture(noise_texture, uv + shift + speed * (1.0 - i * 0.1)).r, density)) * brightness; + } + + COLOR = vec4(vec3(stars), 1.0); +} diff --git a/src/multi-color-starfield/mc_starfield.gdshader.uid b/src/multi-color-starfield/mc_starfield.gdshader.uid new file mode 100644 index 0000000..fc5f2b4 --- /dev/null +++ b/src/multi-color-starfield/mc_starfield.gdshader.uid @@ -0,0 +1 @@ +uid://co0aqe5andoug diff --git a/src/multi-color-starfield/mc_starfield_material.tres b/src/multi-color-starfield/mc_starfield_material.tres new file mode 100644 index 0000000..875952e --- /dev/null +++ b/src/multi-color-starfield/mc_starfield_material.tres @@ -0,0 +1,6 @@ +[gd_resource type="ShaderMaterial" load_steps=2 format=3 uid="uid://bgb22q7b2j1st"] + +[ext_resource type="Shader" uid="uid://co0aqe5andoug" path="res://src/multi-color-starfield/mc_starfield.gdshader" id="1_4pffc"] + +[resource] +shader = ExtResource("1_4pffc") diff --git a/src/multi-color-starfield/multi_color_starfield.tscn b/src/multi-color-starfield/multi_color_starfield.tscn new file mode 100644 index 0000000..e5daeba --- /dev/null +++ b/src/multi-color-starfield/multi_color_starfield.tscn @@ -0,0 +1,17 @@ +[gd_scene load_steps=2 format=3 uid="uid://c6f75hdvqpfaf"] + +[ext_resource type="Material" uid="uid://bgb22q7b2j1st" path="res://src/multi-color-starfield/mc_starfield_material.tres" id="1_yileu"] + +[node name="MultiColorStarfield" type="Control"] +layout_mode = 3 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 + +[node name="ColorRect" type="ColorRect" parent="."] +material = ExtResource("1_yileu") +layout_mode = 0 +offset_right = 1270.0 +offset_bottom = 720.0 diff --git a/src/multi-color-starfield/new_noise_texture_2d.tres b/src/multi-color-starfield/new_noise_texture_2d.tres new file mode 100644 index 0000000..dff5fdb --- /dev/null +++ b/src/multi-color-starfield/new_noise_texture_2d.tres @@ -0,0 +1,6 @@ +[gd_resource type="NoiseTexture2D" load_steps=2 format=3 uid="uid://dgorxcmpu6tma"] + +[ext_resource type="FastNoiseLite" uid="uid://w4lmtnx0twag" path="res://src/multi-color-starfield/mc_fast_noise.tres" id="1_vlauu"] + +[resource] +noise = ExtResource("1_vlauu")