[gd_resource type="ShaderMaterial" load_steps=4 format=2] [ext_resource path="res://resources/graphics/GUI/SelectLanguage/noise.webp" type="Texture" id=1] [ext_resource path="res://resources/graphics/GUI/SelectLanguage/FirstRunBack.webp" type="Texture" id=2] [sub_resource type="Shader" id=9] code = "shader_type canvas_item; uniform sampler2D origin; uniform sampler2D noise; void fragment() { vec2 c = vec2(FRAGCOORD.x, FRAGCOORD.y); vec2 res = vec2(1.0 / SCREEN_PIXEL_SIZE.x,1.0 / SCREEN_PIXEL_SIZE.y); vec2 u = c / res.xy, n = texture(noise, u * .1).rg; // Displacement vec4 f = textureLod(origin, u, 2.5); // Loop through the different inverse sizes of drops for (float r = 4. ; r > 0. ; r--) { vec2 x = res.xy * r * .015, // Number of potential drops (in a grid) p = 6.28 * u * x + (n - .5) * 2., s = sin(p); // Current drop properties. Coordinates are rounded to ensure a // consistent value among the fragment of a given drop. vec4 d = texture(noise, round(u * x - 0.25) / x); // Drop shape and fading float t = (s.x+s.y) * max(0., 1. - fract(TIME * (d.b + .1) + d.g) * 2.); // d.r -> only x% of drops are kept on, with x depending on the size of drops if (d.r < (5.-r)*.08 && t > .5) { // Drop normal vec3 v = normalize(-vec3(cos(p), mix(.2, 2., t-.5))); // fragColor = vec4(v * 0.5 + 0.5, 1.0); // show normals // Poor man's refraction (no visual need to do more) f = texture(origin, u - v.xy * .3); if(f.r == 1.0 && f.g == 1.0 && f.b == 1.0){ f.a = 0.0 } } COLOR = f; } }" [resource] resource_local_to_scene = true shader = SubResource( 9 ) shader_param/origin = ExtResource( 2 ) shader_param/noise = ExtResource( 1 )