-
Notifications
You must be signed in to change notification settings - Fork 6
/
30_Wisps.fs
executable file
·134 lines (120 loc) · 2.24 KB
/
30_Wisps.fs
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
// SaturdayShader Week 30 : Wisps
// by Joseph Fiola (http://www.joefiola.com)
// 2016-03-12
// Based on Week 29 Saturday Shader + "WAVES" Shadertoy by bonniem
// https://www.shadertoy.com/view/4dsGzH
/*{
"CREDIT": "Joseph Fiola",
"DESCRIPTION": "",
"CATEGORIES": [
"Generator"
],
"INPUTS": [
{
"NAME": "lines",
"TYPE": "float",
"DEFAULT": 100.0,
"MIN": 1.0,
"MAX": 200.0
},
{
"NAME": "linesStartOffset",
"TYPE": "float",
"DEFAULT": 0.5,
"MIN": 0.0,
"MAX": 1.0
},
{
"NAME": "amp",
"TYPE": "float",
"DEFAULT": 0.1,
"MIN": 0.0,
"MAX": 1.0
},
{
"NAME": "glow",
"TYPE": "float",
"DEFAULT": -6.0,
"MIN": -40.0,
"MAX": 0.0
},
{
"NAME": "mod1",
"TYPE": "float",
"DEFAULT": 1.0,
"MIN": 0.0,
"MAX": 1.0
},
{
"NAME": "mod2",
"TYPE": "float",
"DEFAULT": 0.01,
"MIN": -1.0,
"MAX": 1.0
},
{
"NAME": "zoom",
"TYPE": "float",
"DEFAULT": 11.0,
"MIN": 0.0,
"MAX": 100.0
},
{
"NAME": "rotateCanvas",
"TYPE": "float",
"DEFAULT": 0.0,
"MIN": 0.0,
"MAX": 1.0
},
{
"NAME": "scroll",
"TYPE": "float",
"DEFAULT": 0.0,
"MIN": 0.0,
"MAX": 1.0
},
{
"NAME": "pos",
"TYPE": "point2D",
"DEFAULT": [0.5,0.5],
"MIN":[0.0,0.0],
"MAX":[1.0,1.0]
},
{
"NAME": "twisted",
"TYPE": "float",
"DEFAULT": 0.01,
"MIN": -0.5,
"MAX": 0.5
}
]
}*/
#define PI 3.14159265359
#define TWO_PI 6.28318530718
mat2 rotate2d(float _angle){
return mat2(cos(_angle),-sin(_angle),
sin(_angle),cos(_angle));
}
void main()
{
vec2 uv = gl_FragCoord.xy / RENDERSIZE.xy;
uv -= vec2(pos);
uv.x *= RENDERSIZE.x/RENDERSIZE.y;
uv *= zoom; // Scale the coordinate system
uv = rotate2d(rotateCanvas*-TWO_PI) * uv;
// waves
vec3 wave_color = vec3(0.0);
float wave_width = 0.01;
//uv = -1.0 + 2.0 * uv;
//uv.y += 0.1;
for(float i = 0.0; i < 200.0; i++) {
uv = rotate2d(twisted*-TWO_PI) * uv;
if (lines <= i) break;
uv.y += sin(sin(uv.x + i*mod1 + (scroll * TWO_PI) ) * amp + (mod2 * PI));
if(lines * linesStartOffset - 1.0 <= i) {
wave_width = abs(1.0 / (50.0 * uv.y * glow));
wave_color += vec3(wave_width, wave_width, wave_width);
}
}
gl_FragColor = vec4(wave_color, 1.0);
}