-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathRipple.tscn
More file actions
32 lines (26 loc) · 1002 Bytes
/
Ripple.tscn
File metadata and controls
32 lines (26 loc) · 1002 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
[gd_scene load_steps=3 format=2]
[sub_resource type="Shader" id=1]
code = "// Converted/modified from ShaderToy: https://www.shadertoy.com/view/ldBXDD
// Attach this shader to a ColorRect
shader_type canvas_item;
uniform float wave_count : hint_range(1.0, 20.0, 1.0) = 20.0;
uniform float speed : hint_range(0.0, 10.0, 0.1) = 3.0;
uniform float height : hint_range(0.0, 0.1, 0.001) = 0.003;
void fragment() {
vec2 cPos = -1.0 + 2.0 * UV / (1.0 / TEXTURE_PIXEL_SIZE);
float cLength = length(cPos);
vec2 uv = FRAGCOORD.xy / (1.0 / SCREEN_PIXEL_SIZE).xy + (cPos/cLength) * cos(cLength * wave_count - TIME * speed) * height;
vec3 col = texture(SCREEN_TEXTURE,uv).xyz;
COLOR = vec4(col,1.0);
}"
[sub_resource type="ShaderMaterial" id=2]
shader = SubResource( 1 )
shader_param/wave_count = 20.0
shader_param/speed = 3.0
shader_param/height = 0.003
[node name="Node2D" type="ColorRect"]
material = SubResource( 2 )
margin_left = -36.0
margin_top = -36.0
margin_right = 36.0
margin_bottom = 36.0