diff --git a/project.godot b/project.godot index 629151e..5e9f660 100644 --- a/project.godot +++ b/project.godot @@ -12,6 +12,7 @@ config_version=5 config/name="simple starfield" config/tags=PackedStringArray("experiment", "git_managed", "project_elysium") +run/main_scene="uid://c6f75hdvqpfaf" config/features=PackedStringArray("4.5", "Forward Plus") config/icon="res://icon.svg" diff --git a/src/multi-color-starfield/mc_fast_noise.tres b/src/multi-color-starfield/mc_fast_noise.tres index e164b3a..8718ec9 100644 --- a/src/multi-color-starfield/mc_fast_noise.tres +++ b/src/multi-color-starfield/mc_fast_noise.tres @@ -2,4 +2,5 @@ [resource] seed = 250 -frequency = 0.4687 +frequency = 0.5267 +fractal_octaves = 10 diff --git a/src/multi-color-starfield/mc_starfield_material.tres b/src/multi-color-starfield/mc_starfield_material.tres index 875952e..160afdd 100644 --- a/src/multi-color-starfield/mc_starfield_material.tres +++ b/src/multi-color-starfield/mc_starfield_material.tres @@ -1,6 +1,17 @@ -[gd_resource type="ShaderMaterial" load_steps=2 format=3 uid="uid://bgb22q7b2j1st"] +[gd_resource type="ShaderMaterial" load_steps=3 format=3 uid="uid://bgb22q7b2j1st"] [ext_resource type="Shader" uid="uid://co0aqe5andoug" path="res://src/multi-color-starfield/mc_starfield.gdshader" id="1_4pffc"] +[ext_resource type="Texture2D" uid="uid://dgorxcmpu6tma" path="res://src/multi-color-starfield/new_noise_texture_2d.tres" id="2_fupeu"] [resource] shader = ExtResource("1_4pffc") +shader_parameter/resolution = Vector2(1270, 720) +shader_parameter/noise_texture = ExtResource("2_fupeu") +shader_parameter/density = 20.0 +shader_parameter/speed_x = 0.005 +shader_parameter/speed_y = 0.0 +shader_parameter/layers = 7.0 +shader_parameter/color_1 = Color(0.3403393, 0.34033933, 0.3403393, 1) +shader_parameter/color_2 = Color(0, 0, 0, 1) +shader_parameter/color_3 = Color(0, 0, 0, 1) +shader_parameter/color_4 = Color(0, 0, 0, 1) diff --git a/src/multi-color-starfield/multi_color_starfield.gdshader b/src/multi-color-starfield/multi_color_starfield.gdshader new file mode 100644 index 0000000..2aec39d --- /dev/null +++ b/src/multi-color-starfield/multi_color_starfield.gdshader @@ -0,0 +1,24 @@ +shader_type canvas_item; + +uniform sampler2D noise_img; +uniform sampler2D gradient_tex; +uniform float speed = 1.0; +uniform vec4 smoke_color : source_color; + +void fragment(){ + vec2 uv1 = vec2(UV.x * 0.5 + TIME*speed, UV.y * 0.5 + TIME*speed*2.0); + vec2 uv2 = vec2(UV.x - TIME*speed, UV.y + TIME*speed*2.0); + vec2 uv3 = vec2(UV.x * 2.0, UV.y * 2.0 + TIME * speed*6.0); + + float gradient = texture( gradient_tex, vec2(UV.y, UV.x) ).r; + float noise_r = texture( noise_img, uv1 ).r; + float noise_g = texture( noise_img, uv2 ).g; + float noise_b = texture( noise_img, uv3 ).b; + + vec3 new_color = vec3(noise_r, noise_g, noise_b); + + float new_alpha = noise_r * noise_g * noise_b * noise_r; + + COLOR.rgb = smoke_color.rgb; + COLOR.a = gradient; +} \ No newline at end of file diff --git a/src/multi-color-starfield/multi_color_starfield.gdshader.uid b/src/multi-color-starfield/multi_color_starfield.gdshader.uid new file mode 100644 index 0000000..28207bc --- /dev/null +++ b/src/multi-color-starfield/multi_color_starfield.gdshader.uid @@ -0,0 +1 @@ +uid://nfhuhvwogwqv diff --git a/src/multi-color-starfield/multi_color_starfield.tscn b/src/multi-color-starfield/multi_color_starfield.tscn index e5daeba..70ac9d7 100644 --- a/src/multi-color-starfield/multi_color_starfield.tscn +++ b/src/multi-color-starfield/multi_color_starfield.tscn @@ -1,6 +1,22 @@ -[gd_scene load_steps=2 format=3 uid="uid://c6f75hdvqpfaf"] +[gd_scene load_steps=7 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"] +[ext_resource type="Shader" uid="uid://nfhuhvwogwqv" path="res://src/multi-color-starfield/multi_color_starfield.gdshader" id="2_mfsqn"] +[ext_resource type="Texture2D" uid="uid://cq1atp8etcqe8" path="res://src/multi-color-starfield/spotlight_3.png" id="3_2bx6i"] + +[sub_resource type="Gradient" id="Gradient_2bx6i"] +colors = PackedColorArray(0, 0, 0, 1, 0.31431612, 0.31431612, 0.3143161, 1) + +[sub_resource type="GradientTexture2D" id="GradientTexture2D_vs6nd"] +gradient = SubResource("Gradient_2bx6i") +fill_from = Vector2(0, 0.032967035) + +[sub_resource type="ShaderMaterial" id="ShaderMaterial_2bx6i"] +shader = ExtResource("2_mfsqn") +shader_parameter/noise_img = ExtResource("3_2bx6i") +shader_parameter/gradient_tex = SubResource("GradientTexture2D_vs6nd") +shader_parameter/speed = 1.0 +shader_parameter/smoke_color = Color(0.09638075, 0.25795576, 0.4848613, 1) [node name="MultiColorStarfield" type="Control"] layout_mode = 3 @@ -10,8 +26,22 @@ anchor_bottom = 1.0 grow_horizontal = 2 grow_vertical = 2 -[node name="ColorRect" type="ColorRect" parent="."] +[node name="ColorRect2" type="ColorRect" parent="."] +visible = false +layout_mode = 0 +offset_right = 1270.0 +offset_bottom = 720.0 +color = Color(0, 0, 0, 1) + +[node name="MonoWhiteStarfield" type="ColorRect" parent="."] material = ExtResource("1_yileu") layout_mode = 0 offset_right = 1270.0 offset_bottom = 720.0 + +[node name="ColorRect" type="ColorRect" parent="."] +material = SubResource("ShaderMaterial_2bx6i") +layout_mode = 0 +offset_top = 2.0 +offset_right = 1270.0 +offset_bottom = 720.0 diff --git a/src/multi-color-starfield/spotlight_3.png b/src/multi-color-starfield/spotlight_3.png new file mode 100644 index 0000000..a91f5d4 Binary files /dev/null and b/src/multi-color-starfield/spotlight_3.png differ diff --git a/src/multi-color-starfield/spotlight_3.png.import b/src/multi-color-starfield/spotlight_3.png.import new file mode 100644 index 0000000..c4cd4c3 --- /dev/null +++ b/src/multi-color-starfield/spotlight_3.png.import @@ -0,0 +1,40 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://cq1atp8etcqe8" +path="res://.godot/imported/spotlight_3.png-8f3bd9bd38798274f67bd2827708b0a6.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://src/multi-color-starfield/spotlight_3.png" +dest_files=["res://.godot/imported/spotlight_3.png-8f3bd9bd38798274f67bd2827708b0a6.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/uastc_level=0 +compress/rdo_quality_loss=0.0 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=false +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/channel_remap/red=0 +process/channel_remap/green=1 +process/channel_remap/blue=2 +process/channel_remap/alpha=3 +process/fix_alpha_border=true +process/premult_alpha=false +process/normal_map_invert_y=false +process/hdr_as_srgb=false +process/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=1