From 39dbc43cbd98e2b09373ddfdf1fdfa1c40efa13f Mon Sep 17 00:00:00 2001 From: Gabriella Date: Wed, 22 Oct 2025 12:18:23 -0600 Subject: [PATCH] Update comments, apply brightness -- which had been mistakenly removed --- .../multi_color_starfield.gdshader | 10 +++++++++- src/multi-color-starfield/multi_color_starfield.tscn | 2 +- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/multi-color-starfield/multi_color_starfield.gdshader b/src/multi-color-starfield/multi_color_starfield.gdshader index 9d8c72e..171415b 100644 --- a/src/multi-color-starfield/multi_color_starfield.gdshader +++ b/src/multi-color-starfield/multi_color_starfield.gdshader @@ -41,8 +41,16 @@ void fragment() { // 1 = more stars // we add shift and speed to the uv value, and apply a simple parallax equation // in order to get movement (as defined by the vec2 `speed` - stars += pow(texture(noise_texture, uv + shift + speed * (1.0 - float(i) * 0.1)).r, density); + stars += pow(texture(noise_texture, uv + shift + speed * (1.0 - float(i) * 0.1)).r, density) * brightness; + // convert this into a vec3 new_stars = vec3(stars); + // using the y value of the UV coordinates, we can thereby + // do a "random" function on that y value + // (as we wont apply a vertical motion to this field). + // from there, we can set the "ratios" of different stars, depending on the y value of the + // 'star' as it moves horizontally (delta(y) = 0) + // --- + // in theory, we can give each star a quasi-unique color by applying the same logic, and setting the RGB values accordingly if (rand_y(uv) >= upper_tolerance_for_star_color){ new_stars.g -= 0.2; new_stars.r -= 1.0; diff --git a/src/multi-color-starfield/multi_color_starfield.tscn b/src/multi-color-starfield/multi_color_starfield.tscn index 0062da3..9ea40e1 100644 --- a/src/multi-color-starfield/multi_color_starfield.tscn +++ b/src/multi-color-starfield/multi_color_starfield.tscn @@ -13,7 +13,7 @@ noise = SubResource("FastNoiseLite_mfsqn") shader = ExtResource("2_mfsqn") shader_parameter/resolution = Vector2(1270, 720) shader_parameter/noise_texture = SubResource("NoiseTexture2D_2bx6i") -shader_parameter/density = 20.0 +shader_parameter/density = 31.40000045299648 shader_parameter/speed_x = 0.005 shader_parameter/speed_y = 0.0 shader_parameter/layers = 5.0