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 return abs(mod(t, 2.0 * maxT) - maxT);
116vec2
tremor(vec2 uv,
float freq,
float amp,
float phase) {
117 float x = sin(uv.y * freq +
iTime * 5.0 + phase) *
amp;
118 float y = cos(uv.x * freq +
iTime * 5.0 + phase) *
amp;
119 return uv + vec2(x, y);
127 vec2 uv = (tc - 0.5) * vec2(aspect, 1.0);
129 vec3 acc = vec3(0.0);
130 for (
int i = 0; i < 8; i++) {
131 float h =
specHist(i, 0.05 +
float(i) * 0.06);
136 float ampQ = (0.015 + bass * 0.08) * intervalFactor;
137 vec2 suv =
tremor(tc, 18.0 +
h * 50.0, ampQ,
float(i) * 0.7);
140 float ang = float(i) * 0.4 +
h2 * 3.0;
141 vec2 dir = vec2(cos(ang), sin(ang));
142 float fringe = sin(dot(uv, dir) * (40.0 +
h * 80.0) +
iTime * (1.0 +
h * 4.0));
143 fringe = pow(fringe * 0.5 + 0.5, 4.0);
144 suv += dir * fringe * 0.06 * (1.0 + bass * 3.0);
147 c.r =
cacheHist(i, fract(suv) + vec2(
h * 0.1, 0.0)).r;
149 c.b =
cacheHist(i, fract(suv) - vec2(
h * 0.1, 0.0)).b;
151 vec3 tint =
palette(
float(i) * 0.13 +
h * 4.0, vec3(0.0, 0.33, 0.66));
152 acc += (c + tint * fringe * 0.6) * (1.0 +
h * 5.0 + bass * 4.0) * pow(0.82,
float(i));
156 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)
float pingPong(float x, float length)
Evaluates pingPong for this shader effect.
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 tremor(vec2 uv, float freq, float amp, float phase)
Evaluates tremor for this shader effect.
float h(vec2 p)
Evaluates h for this shader effect.