3layout(set = 0, binding = 1, std140) uniform SpriteExtended {
9 vec4 custom_uniforms[16];
13#define amp_peak ext.u2.w
14#define amp_smooth ext.u3.w
15#define history_head int(ext.u3.x)
16#define iResolution ext.u0.zw
18#define spectrum_history_head int(ext.audio_history.x)
19#define spectrum_history_size int(ext.audio_history.y)
29layout(location = 0) out vec4 color;
30layout(set = 0, binding = 0) uniform sampler2D samp;
31layout(set = 0, binding = 2) uniform sampler2DArray history;
36#ifndef CACHE_HISTORY_LAYER
37#define CACHE_HISTORY_LAYER(index) ((history_head + (index)) % SIZE)
39layout(set = 0, binding = 3) uniform sampler1D spectrum0;
40layout(set = 0, binding = 4) uniform sampler1DArray spectrum_history;
43#ifndef SPECTRUM_HISTORY_LAYER
44#define SPECTRUM_HISTORY_LAYER(index) ((spectrum_history_head - ((index) % max(spectrum_history_size, 1)) + max(spectrum_history_size, 1)) % max(spectrum_history_size, 1))
51const float TAU = 6.28318530718;
60 if (i == 0)
return texture(spectrum0, f).r;
77 if (i == 0)
return texture(samp, uv);
95 return 0.5 + 0.5 * cos(
TAU * (vec3(1.0) * t + d));
105 float c = cos(a), s = sin(a);
106 return mat2(c, -s, s, c) * p;
118 for (
int k = 0; k < 5; k++) {
119 p = abs(p * (zoom + 0.15 * sin(t * 0.4 +
float(k) +
float(i)))) - 0.5;
120 p =
rot2(p, t * 0.12 +
float(k) * 0.07 +
float(i) * 0.2);
132 ivec3 ia = ivec3(clamp(a, 0.0, 1.0) * 255.0);
133 ivec3 ib = ivec3(clamp(b, 0.0, 1.0) * 255.0);
135 return vec3(ic) / 255.0;
143 vec2 uv = (tc - 0.5) * vec2(aspect, 1.0);
145 vec3 acc = vec3(0.0);
146 vec3 prev = vec3(0.0);
147 for (
int i = 0; i < 8; i++) {
148 float h =
specHist(i, 0.05 +
float(i) * 0.06);
154 float zoom = 1.4 + 0.5 * sin(
iTime * 0.42 +
float(i) +
h * 3.0);
156 vec2 suv = p / vec2(aspect, 1.0) + 0.5;
160 float ang = float(i) * 0.4 +
h2 * 3.0;
161 vec2 dir = vec2(cos(ang), sin(ang));
162 float fringe = sin(dot(uv, dir) * (40.0 +
h * 80.0) +
iTime * (1.0 +
h * 4.0));
163 fringe = pow(fringe * 0.5 + 0.5, 4.0);
164 suv += dir * fringe * 0.04 * (1.0 +
h);
168 c.r =
cacheHist(i, suv + vec2(
h * 0.06, 0.0)).r;
170 c.b =
cacheHist(i, suv - vec2(
h * 0.06, 0.0)).b;
172 vec3 tint =
palette(
float(i) * 0.13 +
h * 4.0, vec3(0.0, 0.33, 0.66));
173 vec3 layer = (c + tint * fringe * 0.6) * (1.0 +
h * 5.0);
177 layer = mix(layer,
xorBlend(layer, prev), 0.45 + bass * 0.5);
180 acc += layer * pow(0.83,
float(i));
184 color = vec4(clamp(acc, 0.0, 1.0), 1.0);
layout(set=0, binding=1, std140) uniform SpriteExtended
void main(void)
Executes the fragment shader entry point.
#define CACHE_HISTORY_LAYER(index)
vec3 palette(float phase)
Evaluates palette for this shader effect.
#define SPECTRUM_HISTORY_LAYER(index)
vec2 h2(vec2 p)
Evaluates h2 for this shader effect.
float specHist(int i, float f)
Evaluates specHist for this shader effect.
vec4 cacheHist(int i, vec2 uv)
Evaluates cacheHist for this shader effect.
vec2 rot2(vec2 p, float a)
Evaluates rot2 for this shader effect.
vec3 xorBlend(vec3 a, vec3 b)
Evaluates xorBlend for this shader effect.
vec2 fractalFold(vec2 p, float zoom, float t, int i)
Evaluates fractalFold for this shader effect.
float h(vec2 p)
Evaluates h for this shader effect.