-
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathlaser.shader
More file actions
31 lines (25 loc) · 750 Bytes
/
laser.shader
File metadata and controls
31 lines (25 loc) · 750 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
shader_type canvas_item;
float line(vec2 uv, float t) {
uv.x = .0;
float il = length(uv-.5);
float l = smoothstep(.7+sin(t*5.)*.0075,.4,il);
l += smoothstep(.505,.5,il)/2.;
return l;
}
float wobble(vec2 uv, float t, float amp, float freq, float width) {
float il = length(vec2(uv.y-.5)+sin((uv.x-t)*freq)*amp);
float l = smoothstep(width,width-.05,il);
return l;
}
void fragment() {
vec3 col = vec3(.9,.1,.1);
float fx = line(UV, TIME);
fx += wobble(UV, TIME*2., .1, 10.,.04);
fx += wobble(UV, TIME*1.456, .3, 12.,.03);
fx += wobble(UV, TIME*0.876, .2, 14.,.025);
fx += wobble(UV, TIME, .15, 8.,.03);
col *= fx;
if (fx > 1.)
col.gb += col.r/2.;
COLOR = vec4(col,fx);
}