Skip to content

Commit b87c2d2

Browse files
committed
update shaders for forbidden device
1 parent b341d56 commit b87c2d2

File tree

8 files changed

+96
-77
lines changed

8 files changed

+96
-77
lines changed

assets/shaders/entr_glitched.fs

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -161,9 +161,12 @@ vec4 HSVtoRGB(vec4 hsv) {
161161

162162
float bitxor(float val1, float val2)
163163
{
164-
float outp = 0;
165-
for(int i = 1; i < 9; i++) outp += floor(mod(mod(floor(val1*pow(2,-i)),pow(2,i))+mod(floor(val2*pow(2,-i)),pow(2,i)),2))*pow(2,i);
166-
return outp/256;
164+
float outp = 0.;
165+
for(int i = 1; i < 9; i++) {
166+
float i_float = float(i);
167+
outp += floor(mod(mod(floor(val1*pow(2.,-i_float)),pow(2.,i_float))+mod(floor(val2*pow(2.,-i_float)),pow(2.,i_float)),2.))*pow(2.,i_float);
168+
}
169+
return outp/256.;
167170
}
168171

169172
float mod2(float val1, float mod1)
@@ -226,13 +229,14 @@ vec4 effect( vec4 colour, Image texture, vec2 texture_coords, vec2 screen_coords
226229
float mby;
227230
float offx;
228231
float offy;
229-
float rmasksum = -1;
230-
float rectmask = 1;
231-
t = floor(t/4);
232+
float rmasksum = -1.;
233+
float rectmask = 1.;
234+
t = floor(t/4.);
232235

233236
for(int i = 0; i < 5; i++)
234237
{
235-
randnum = bitxor(255.0*randnum + mod2(t,81.0), pow(randnum*(16.0-i), 2.0));
238+
float i_float = float(i);
239+
randnum = bitxor(255.0*randnum + mod2(t,81.0), pow(randnum*(16.0-i_float), 2.0));
236240
mbx = (cx - 25.0*sin(100.0/randnum)) * (1.0 + 2.0*(floor(cos(177.0/randnum + 1.0))));
237241
mby = (cy - 25.0*cos(113.0/randnum + 1.0)) * (1.0 + 2.0*(floor(sin(221.0/randnum))));
238242
offx = bitxor(255.0*randnum, pow(255.0*randnum,5.0) - 255.0*randnum);
@@ -259,7 +263,7 @@ vec4 effect( vec4 colour, Image texture, vec2 texture_coords, vec2 screen_coords
259263
float res = (.5 + .5* cos( (entr_glitched.x) * 2.612 + ( field + -.5 ) *3.14));
260264
vec4 textp = RGB(hsl);
261265
tex.rgb = textp.rgb;
262-
return dissolve_mask(tex*colour, texture_coords, uv);
266+
return dissolve_mask(tex*colour, texture_coords, uv);
263267
}
264268

265269
extern MY_HIGHP_OR_MEDIUMP vec2 mouse_screen_pos;

assets/shaders/fractured.fs

Lines changed: 21 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -111,11 +111,11 @@ vec4 effect( vec4 colour, Image texture, vec2 texture_coords, vec2 screen_coords
111111
);
112112
noise = fract(sin(noise) * 0.0); //143758.5453);
113113

114-
vec2 offset = 1/image_details*vec2(1,0);
114+
vec2 offset = 1./image_details*vec2(1,0);
115115
vec4 tex = Texel(texture, texture_coords);
116116
tex.r = Texel(texture,texture_coords+offset).r;
117117
tex.rgb += vec3(0.0,-0.1,0.2)-fractured.x*0.1;
118-
tex.rgb += max(0, pow(noise.x*noise.y,8));
118+
tex.rgb += max(0., pow(noise.x*noise.y,8.));
119119
number low = min(tex.r, min(tex.g, tex.b));
120120
number high = max(tex.r, max(tex.g, tex.b));
121121
number delta = high - low;
@@ -158,11 +158,11 @@ vec4 effect( vec4 colour, Image texture, vec2 texture_coords, vec2 screen_coords
158158

159159
float t2 = t/250.0; // animation speed
160160
const int TileC = 40; // tile count
161-
float fracOff = 10; //offset of fractures
161+
float fracOff = 10.; //offset of fractures
162162

163163

164-
float light = 0;
165-
float uvScale = 3;
164+
float light = 0.;
165+
float uvScale = 3.;
166166

167167
float cX = uv_scaled_centered.x * 0.05 * uvScale;
168168
float cY = uv_scaled_centered.y * 0.05 * uvScale;
@@ -171,22 +171,23 @@ vec4 effect( vec4 colour, Image texture, vec2 texture_coords, vec2 screen_coords
171171
float pointPlats[TileC];
172172

173173
for(int i=0; i<TileC; i += 2){
174-
175-
pointCenters[i][0] = pow(1.73 * (2.0 + sin(3.38 * (0.3 + i/3.0) * (0.17 + i))), -1) * cos(t2 + 11.0 * i);
176-
pointCenters[i][1] = pow(1.17 * (2.0 + cos(2.11 * (0.3 + i/5.0) * (0.31 + i))), -1) * sin(t2 + 7.0 * i + 2.0);
174+
float i_float = float(i);
175+
pointCenters[i][0] = pow(1.73 * (2.0 + sin(3.38 * (0.3 + i_float/3.0) * (0.17 + i_float))), -1.) * cos(t2 + 11.0 * i_float);
176+
pointCenters[i][1] = pow(1.17 * (2.0 + cos(2.11 * (0.3 + i_float/5.0) * (0.31 + i_float))), -1.) * sin(t2 + 7.0 * i_float + 2.0);
177177
float vecSize = pointCenters[i][0]*pointCenters[i][0] + pointCenters[i][1]*pointCenters[i][1];
178178
pointCenters[i][0] = pointCenters[i][0] / (vecSize + 0.1);
179179
pointCenters[i][1] = pointCenters[i][1] / (vecSize + 0.1);
180180
pointPlats[i] = 0.0;
181181
}
182182

183-
for(int i=0; i<TileC; i += 2){
184-
float rescale = mod(i, 5) - 1.0;
183+
for(int i=0; i<TileC; i += 2){
184+
float i_float = float(i);
185+
float rescale = mod(i_float, 5.) - 1.0;
185186
rescale = max(0.0, rescale);
186187
rescale = min(1.0, rescale);
187-
rescale = 2.8*rescale + 0.2 + sin(i + t2 + 0.11)*0.3;
188-
pointCenters[i+1][0] = pointCenters[i][0]*rescale + sin(i + 0.1)/8;
189-
pointCenters[i+1][1] = pointCenters[i][1]*rescale + cos(i + 0.1)/8;
188+
rescale = 2.8*rescale + 0.2 + sin(i_float + t2 + 0.11)*0.3;
189+
pointCenters[i+1][0] = pointCenters[i][0]*rescale + sin(i_float + 0.1)/8.;
190+
pointCenters[i+1][1] = pointCenters[i][1]*rescale + cos(i_float + 0.1)/8.;
190191
pointPlats[i] = 0.0;
191192
}
192193

@@ -195,20 +196,22 @@ vec4 effect( vec4 colour, Image texture, vec2 texture_coords, vec2 screen_coords
195196
}
196197

197198
for(int i=0; i<TileC; i++){
198-
pointPlats[i] = floor(0.001 + (1/(1 + pow(pointCenters[i][0] - cX, 2.0) + pow(pointCenters[i][1] - cY, 2.0)))/light);
199+
pointPlats[i] = floor(0.001 + (1./(1. + pow(pointCenters[i][0] - cX, 2.0) + pow(pointCenters[i][1] - cY, 2.0)))/light);
199200
}
200201

201202
float col = 0.0;
202203
float qalph = 0.0;
203204
float ShiftX = 0.0;
204205
float ShiftY = 0.0;
205206

206-
for(int i=0; i<TileC; i++){
207+
for(int i=0; i < TileC; i++){
208+
float i_float = float(i);
209+
float TileC_float = float(TileC);
207210
float dist = pow(pointCenters[i][0], 2.0) + pow(pointCenters[i][1], 2.0);
208-
col += min(1.0, pointPlats[i]) * i/TileC;
211+
col += min(1.0, pointPlats[i]) * i_float/TileC_float;
209212
qalph += min(1.0, pointPlats[i]) * pow(dist, 0.75);
210-
ShiftX += min(1.0, pointPlats[i]) * pointCenters[i][0]/(1.0 + pow(pointCenters[i][0], 2)) * sin(0.23 * i + 0.31 - t2/51.0);
211-
ShiftY += min(1.0, pointPlats[i]) * pointCenters[i][1]/(1.0 + pow(pointCenters[i][1], 2)) * cos(0.17 * i + 0.81 + t2/12.0);
213+
ShiftX += min(1.0, pointPlats[i]) * pointCenters[i][0]/(1.0 + pow(pointCenters[i][0], 2.)) * sin(0.23 * i_float + 0.31 - t2/51.0);
214+
ShiftY += min(1.0, pointPlats[i]) * pointCenters[i][1]/(1.0 + pow(pointCenters[i][1], 2.)) * cos(0.17 * i_float + 0.81 + t2/12.0);
212215
}
213216

214217
hsl.y += 0.33;

assets/shaders/freaky.fs

Lines changed: 21 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -161,9 +161,12 @@ vec4 HSVtoRGB(vec4 hsv) {
161161

162162
float bitxor(float val1, float val2)
163163
{
164-
float outp = 0;
165-
for(int i = 1; i < 9; i++) outp += floor(mod(mod(floor(val1*pow(2,-i)),pow(2,i))+mod(floor(val2*pow(2,-i)),pow(2,i)),2))*pow(2,i);
166-
return outp/256;
164+
float outp = 0.;
165+
for(int i = 1; i < 9; i++) {
166+
float i_float = float(i);
167+
outp += floor(mod(mod(floor(val1*pow(2.,-i_float)),pow(2.,i_float))+mod(floor(val2*pow(2.,-i_float)),pow(2.,i_float)),2.))*pow(2.,i_float);
168+
}
169+
return outp/256.;
167170
}
168171

169172
float mod2(float val1, float mod1)
@@ -175,30 +178,30 @@ float mod2(float val1, float mod1)
175178

176179
float mod2(float val1)
177180
{
178-
return(mod2(val1, 1));
181+
return(mod2(val1, 1.));
179182
}
180183

181184
float clampf(float val1)
182185
{
183-
return(max(0, min(1, ceil(val1))));
186+
return(max(0., min(1., ceil(val1))));
184187
}
185188

186189
float clampf2(float val1)
187190
{
188-
return(max(0, min(1, val1)));
191+
return(max(0., min(1., val1)));
189192
}
190193

191194
float heartf(float xcoord, float ycoord)
192195
{
193-
float temp1 = 0;
194-
temp1 += pow(xcoord, 2);
195-
temp1 += pow(1.6 * ycoord - pow(abs(xcoord), 0.5), 2);
196+
float temp1 = 0.;
197+
temp1 += pow(xcoord, 2.);
198+
temp1 += pow(1.6 * ycoord - pow(abs(xcoord), 0.5), 2.);
196199
return(temp1);
197200
}
198201

199202
float inverf(float val1)
200203
{
201-
return(val1 + pow(val1, 5) * pow(14 - 14*pow(val1, 2), -1));
204+
return(val1 + pow(val1, 5.) * pow(14. - 14.*pow(val1, 2.), -1.));
202205
}
203206

204207

@@ -235,7 +238,7 @@ vec4 effect( vec4 colour, Image texture, vec2 texture_coords, vec2 screen_coords
235238

236239
vec4 pixel = Texel(texture, texture_coords);
237240
vec4 hsl = HSL(vec4(tex.r, tex.g, tex.b, tex.a));
238-
float t2 = mod2(t/7);
241+
float t2 = mod2(t/7.);
239242

240243
float cx = uv_scaled_centered.x / 3.0;
241244
float cy = uv_scaled_centered.y / 3.0;
@@ -257,10 +260,12 @@ vec4 effect( vec4 colour, Image texture, vec2 texture_coords, vec2 screen_coords
257260

258261
for(int i = 0; i < hcount; i++)
259262
{
260-
float i2 = i * pow(hcount, -1);
263+
float h_float = float(hcount);
264+
float i_float = float(i);
265+
float i2 = i_float * pow(h_float, -1.);
261266
float hsize = inverf(mod2(t2 + i2));
262-
float cx1 = hscale * 7.1 * sin(1 + 7.0 * i + floor(t/7.0 + i2));
263-
float cy1 = hscale * 9.5 * sin(5.0 * i + floor(t/7.0 + i2));
267+
float cx1 = hscale * 7.1 * sin(1. + 7.0 * i_float + floor(t/7.0 + i2));
268+
float cy1 = hscale * 9.5 * sin(5.0 * i_float + floor(t/7.0 + i2));
264269
float heart_opacity = clampf2(0.9 - pow(mod2(t2 + i2), 2.0)) - pow(2.0, -1000.0 * pow(mod2(t2 + i2), 2.0));
265270
float t3 = speed_extra * (5.0*pow(mod2(t2 + i2), 2.0) - 10.0*(mod2(t2 + i2)) + 2.0 - pow(10.0*(mod2(t2 + i2)), 0.2));
266271

@@ -285,14 +290,13 @@ vec4 effect( vec4 colour, Image texture, vec2 texture_coords, vec2 screen_coords
285290
float res = (.5 + .5* cos( (freaky.x) * 2.612 + ( field + -.5 ) *3.14));
286291
vec4 textp = RGB(hsl);
287292
tex.rgb = textp.rgb;
288-
return dissolve_mask(tex*colour, texture_coords, uv);
293+
return dissolve_mask(tex*colour, texture_coords, uv);
289294
}
290295

291296
extern MY_HIGHP_OR_MEDIUMP vec2 mouse_screen_pos;
292297
extern MY_HIGHP_OR_MEDIUMP float hovering;
293298
extern MY_HIGHP_OR_MEDIUMP float screen_scale;
294299

295-
#ifdef VERTEX
296300
vec4 position( mat4 transform_projection, vec4 vertex_position )
297301
{
298302
if (hovering <= 0.){
@@ -304,5 +308,4 @@ vec4 position( mat4 transform_projection, vec4 vertex_position )
304308
*hovering*(length(mouse_offset)*length(mouse_offset))/(2. -mid_dist);
305309

306310
return transform_projection * vertex_position + vec4(0,0,0,scale);
307-
}
308-
#endif
311+
}

assets/shaders/kaleidoscopic.fs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,11 +108,11 @@ vec4 effect( vec4 colour, Image texture, vec2 texture_coords, vec2 screen_coords
108108
);
109109
noise = fract(sin(noise) * 0.0); //143758.5453);
110110

111-
vec2 offset = 1/image_details*vec2(1,0);
111+
vec2 offset = 1./image_details*vec2(1.,0);
112112
vec4 tex = Texel(texture, texture_coords);
113113
tex.r = Texel(texture,texture_coords+offset).r;
114114
tex.rgb += vec3(0.0,-0.1,0.2)-kaleidoscopic.x*0.1;
115-
tex.rgb += max(0, pow(noise.x*noise.y,8));
115+
tex.rgb += max(0., pow(noise.x*noise.y,8.));
116116
number low = min(tex.r, min(tex.g, tex.b));
117117
number high = max(tex.r, max(tex.g, tex.b));
118118
number delta = high - low;

assets/shaders/lowres.fs

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -161,11 +161,13 @@ vec4 HSVtoRGB(vec4 hsv) {
161161

162162
float bitxor(float val1, float val2)
163163
{
164-
float outp = 0;
165-
for(int i = 1; i < 9; i++) outp += floor(mod(mod(floor(val1*pow(2,-i)),pow(2,i))+mod(floor(val2*pow(2,-i)),pow(2,i)),2))*pow(2,i);
166-
return outp/256;
164+
float outp = 0.;
165+
for(int i = 1; i < 9; i++) {
166+
float i_float = float(i);
167+
outp += floor(mod(mod(floor(val1*pow(2.,-i_float)),pow(2.,i_float))+mod(floor(val2*pow(2.,-i_float)),pow(2.,i_float)),2.))*pow(2.,i_float);
168+
}
169+
return outp/256.;
167170
}
168-
169171
float mod2(float val1, float mod1)
170172
{
171173
val1 /= mod1;
@@ -220,9 +222,9 @@ vec4 effect( vec4 colour, Image texture, vec2 texture_coords, vec2 screen_coords
220222
vec4 rgb = HSVtoRGB(hsl);
221223

222224

223-
rgb.r = rgb.r * (0.0 + floor(mod2(cx/9 + 0.0000) + 0.3333));
224-
rgb.g = rgb.g * (0.0 + 0.7 * floor(mod2(cx/9 + 0.3333) + 0.3333));
225-
rgb.b = rgb.b * (0.0 + floor(mod2(cx/9 + 0.6667) + 0.3333));
225+
rgb.r = rgb.r * (0.0 + floor(mod2(cx/9. + 0.0000) + 0.3333));
226+
rgb.g = rgb.g * (0.0 + 0.7 * floor(mod2(cx/9. + 0.3333) + 0.3333));
227+
rgb.b = rgb.b * (0.0 + floor(mod2(cx/9. + 0.6667) + 0.3333));
226228

227229

228230
hsl = RGBtoHSV(rgb);
@@ -232,8 +234,8 @@ vec4 effect( vec4 colour, Image texture, vec2 texture_coords, vec2 screen_coords
232234

233235
//hsl.x = floor(cx/3)/3;
234236
//hsl.z = (3 + hsl.z)/5;
235-
hsl.z -= max(0.0, pow(sin(6.28*mod2(cx/9 + 0.25)), 4.0) - 0.2);
236-
hsl.z -= max(0.0, pow(sin(6.28*mod2(cy/9 + 0.25)), 4.0) - 0.2);
237+
hsl.z -= max(0.0, pow(sin(6.28*mod2(cx/9. + 0.25)), 4.0) - 0.2);
238+
hsl.z -= max(0.0, pow(sin(6.28*mod2(cy/9. + 0.25)), 4.0) - 0.2);
237239
hsl.z = max(hsl.z, 0.0);
238240
//hsl.z -= floor(mod2(cx/9 - 0.05) + 0.1);
239241
//hsl.z -= floor(mod2(cy/9 - 0.05) + 0.1);

assets/shaders/neon.fs

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -161,9 +161,12 @@ vec4 HSVtoRGB(vec4 hsv) {
161161

162162
float bitxor(float val1, float val2)
163163
{
164-
float outp = 0;
165-
for(int i = 1; i < 9; i++) outp += floor(mod(mod(floor(val1*pow(2,-i)),pow(2,i))+mod(floor(val2*pow(2,-i)),pow(2,i)),2))*pow(2,i);
166-
return outp/256;
164+
float outp = 0.;
165+
for(int i = 1; i < 9; i++) {
166+
float i_float = float(i);
167+
outp += floor(mod(mod(floor(val1*pow(2.,-i_float)),pow(2.,i_float))+mod(floor(val2*pow(2.,-i_float)),pow(2.,i_float)),2.))*pow(2.,i_float);
168+
}
169+
return outp/256.;
167170
}
168171

169172
float mod2(float val1, float mod1)
@@ -207,18 +210,18 @@ vec4 effect( vec4 colour, Image texture, vec2 texture_coords, vec2 screen_coords
207210

208211
vec4 pixel = Texel(texture, texture_coords);
209212

210-
float cx = uv_scaled_centered.x * 1;
211-
float cy = uv_scaled_centered.y * 1;
213+
float cx = uv_scaled_centered.x * 1.;
214+
float cy = uv_scaled_centered.y * 1.;
212215

213216
float randnum = mod2(floor(4.0*t), 256.0)*mod2(floor(4.0*t), 27.0);
214-
randnum = mod2(bitxor(pow(randnum, 3.0) - randnum + 3, 7 + floor(randnum/11.0)), 256.0);
217+
randnum = mod2(bitxor(pow(randnum, 3.0) - randnum + 3., 7. + floor(randnum/11.0)), 256.0);
215218
randnum = mod2(randnum*123.54,0.1)*10.0;
216219

217220
vec4 hsl = HSL(vec4(tex.r, tex.g, tex.b, tex.a));
218221

219222
//hsl.z -= hsl.y/2;
220223
//hsl.y = 1- hsl.y;
221-
hsl.z = 1 - hsl.z;
224+
hsl.z = 1. - hsl.z;
222225
hsl.x = floor(hsl.x*12.0)/12.0;
223226
hsl.z = hsl.z * pow(hsl.y, 3.0);
224227
hsl.x = pow(hsl.x, 0.5);

assets/shaders/solar.fs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -93,11 +93,11 @@ vec4 effect( vec4 colour, Image texture, vec2 texture_coords, vec2 screen_coords
9393
);
9494
noise = fract(sin(noise) * 0.0); //143758.5453);
9595

96-
vec2 offset = 1/image_details*vec2(1,0);
96+
vec2 offset = 1.0/image_details*vec2(1.0,0.0);
9797
vec4 tex = Texel(texture, texture_coords);
9898
tex.r = Texel(texture,texture_coords+offset).r;
9999
tex.rgb += vec3(0.0,-0.1,0.2)-solar.x*0.1;
100-
tex.rgb += max(0, pow(noise.x*noise.y,8));
100+
tex.rgb += max(0.0, pow(noise.x*noise.y,8.0));
101101
number low = min(tex.r, min(tex.g, tex.b));
102102
number high = max(tex.r, max(tex.g, tex.b));
103103
number delta = high - low;
@@ -125,14 +125,14 @@ vec4 effect( vec4 colour, Image texture, vec2 texture_coords, vec2 screen_coords
125125
q6 = q6*q6;
126126
q6 = q6*q6;
127127

128-
float q3 = 2.0 * (floor(0.5 + t2/2.0) - floor(t2/2.0)) - 1;
128+
float q3 = 2.0 * (floor(0.5 + t2/2.0) - floor(t2/2.0)) - 1.0;
129129
float q4 = sin((3.0 * t2/1.73 + 1.0 + field * 5.0)*1.5)/2.5 + sin(13.0 * t2/2.63 + solar.x*4.0)/10.0 + 0.5; // wavey stuff
130-
float res = (q3*q6 - floor(q3*q6))*q4 + (1-(q3*q6 - floor(q3*q6)))*(1-q4); // transparency
130+
float res = (q3*q6 - floor(q3*q6))*q4 + (1.-(q3*q6 - floor(q3*q6)))*(1.-q4); // transparency
131131

132132
hsl.x = 0.08;
133133
hsl.y = 0.7;
134134
hsl.z = (0.8*hsl.z + res*res*0.2) * (0.3 + uv.y);
135-
float qalph = 0.66 + res/3;
135+
float qalph = 0.66 + res/3.;
136136

137137
tex.rgb = RGB(hsl).rgb;
138138

0 commit comments

Comments
 (0)