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));
103 vec2 uv = (tc - 0.5) * vec2(aspect, 1.0);
104 float rad = length(uv);
105 float theta = atan(uv.y, uv.x);
107 vec3 acc = vec3(0.0);
109 for (
int i = 0; i < 8; i++) {
110 float h =
specHist(i, 0.05 +
float(i) * 0.06);
114 float ang = float(i) * 0.4 +
h2 * 3.0;
115 vec2 dir = vec2(cos(ang), sin(ang));
116 float fringe = sin(dot(uv, dir) * (40.0 +
h * 80.0) +
iTime * (1.0 +
h * 4.0));
117 fringe = pow(fringe * 0.5 + 0.5, 4.0);
118 vec2 suv = tc + dir * fringe * 0.04 * (1.0 +
h);
121 c.r =
cacheHist(i, suv + vec2(
h * 0.08, 0.0)).r;
123 c.b =
cacheHist(i, suv - vec2(
h * 0.08, 0.0)).b;
124 vec3 tint =
palette(
float(i) * 0.13 +
h * 4.0, vec3(0.0, 0.33, 0.66));
125 acc += (c + tint * fringe * 0.4) * (1.0 +
h * 5.0) * pow(0.83,
float(i));
128 float N = 6.0 + float(i) * 2.0;
129 float pat = abs(sin(
N * theta +
iTime * 0.5 +
h * 4.0)
130 * cos(
N * rad -
iTime * 0.7 +
h2 * 4.0));
131 lattice += tint * pat * (0.18 +
h * 0.6);
138 outc = mix(outc, abs(sin(outc * (1.5 +
amp_peak))), 0.18);
139 color = vec4(clamp(outc, 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.
float h(vec2 p)
Evaluates h for this shader effect.
float N(vec2 p)
Evaluates N for this shader effect.
float lattice(vec2 point, float bass, float middle, float high)
Evaluates lattice for this shader effect.