small refactor made to the shaders
authorEduardo <[email protected]>
Mon, 25 Sep 2023 18:01:20 +0000 (20:01 +0200)
committerEduardo <[email protected]>
Mon, 25 Sep 2023 18:01:20 +0000 (20:01 +0200)
scenes/main_menu/MainMenu.tscn
themes/default/backgrounds/home_screen_dots.gdshader

index 7bb05545c88f358d6e8e9d6aca065014a3b06427..dc46917fdfecbaf96408eca7a43b9038cb2574ef 100644 (file)
@@ -10,7 +10,6 @@
 [sub_resource type="ShaderMaterial" id="ShaderMaterial_v5r1v"]
 shader = ExtResource("6_xkkpt")
 shader_parameter/dots_color = Vector4(1, 0.86, 0.83, 1)
-shader_parameter/bg_color = Vector4(1, 0.95, 0.91, 1)
 shader_parameter/radius = 0.09
 shader_parameter/grid_size = 6.0
 shader_parameter/speed = 0.1
index 578368d94d64aabe4329c7e487259ba3c06a03d4..97bb5e00b2e82fc5c839bdad77ecc33ccfd8cb6e 100644 (file)
@@ -1,26 +1,25 @@
 shader_type canvas_item;
 
 uniform vec4 dots_color = vec4(1, 0.86, 0.83, 1);
-uniform vec4 bg_color = vec4(1, 0.95, 0.91, 1);
 uniform float radius: hint_range(0.0, 1.0, 0.01) = .07;
 uniform float grid_size: hint_range(1.0, 200.0, 1.00) = 7.;
 uniform float speed: hint_range(0.0, 1.0, 0.01) = .2;
 
 void fragment() {
-       vec2 uv = (FRAGCOORD.xy - (1.0 / SCREEN_PIXEL_SIZE).xy) / min((1.0 / SCREEN_PIXEL_SIZE).x,(1.0 / SCREEN_PIXEL_SIZE).y);
-    uv *= grid_size;
+       vec2 uv = (FRAGCOORD.xy - (1.0 / SCREEN_PIXEL_SIZE).xy) / min((1.0 / SCREEN_PIXEL_SIZE).x, (1.0 / SCREEN_PIXEL_SIZE).y);
+       uv *= grid_size;
 
     // movement
        uv.x -= TIME * speed;
        uv.y += TIME * speed;
 
     // Here is where the offset is happening
-    uv.x += step(1., mod(uv.y,2.0)) * .5;
+    uv.x += step(1.0, mod(uv.y, 2.0)) * .5;
 
        // circle
        vec2 fractal = fract(uv);
-    float c = length(.5 - fractal);
-       float min_dist = min(c, 1.);
+    float c = length(0.5 - fractal);
+       float min_dist = min(c, 1.0);
 
        // anti-aliased
     float d = length(uv);
@@ -28,5 +27,5 @@ void fragment() {
     float circle = smoothstep(radius + wd, radius - wd, min_dist);
 
     // colors
-    COLOR = mix(bg_color, dots_color, circle);
+    COLOR = mix(COLOR, dots_color, circle);
 }
\ No newline at end of file