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;
52const float PI = 3.14159265359;
61 if (i == 0)
return texture(spectrum0, f).r;
78 if (i == 0)
return texture(samp, uv);
96 return 0.5 + 0.5 * cos(
TAU * (vec3(1.0) * t + d));
105 return fract(sin(dot(p, vec2(127.1, 311.7))) * 43758.5453);
114 vec2 i = floor(p), f = fract(p);
115 vec2 u = f * f * (3.0 - 2.0 * f);
116 return mix(mix(
hash(i),
hash(i + vec2(1, 0)), u.x),
117 mix(
hash(i + vec2(0, 1)),
hash(i + vec2(1, 1)), u.x), u.y);
126 float v = 0.0, a = 0.5;
127 mat2 r = mat2(0.87758, 0.47943, -0.47943, 0.87758);
128 for (
int k = 0; k < 5; k++) { v += a *
vnoise(p); p = r * p * 2.02; a *= 0.5; }
144 vec2 q = vec2(
fbm(p + vec2(0.0, 0.0) + 0.05 * t),
145 fbm(p + vec2(5.2, 1.3) + 0.05 * t));
146 vec2 r = vec2(
fbm(p + 4.0 * q + vec2(t * 0.2)),
147 fbm(p + 4.0 * q + vec2(t * 0.1, 2.8)));
148 vec2 fluid = uv + r * (0.18 +
h * 0.35);
151 float ang = float(i) * 0.4 +
h2 * 3.0;
152 vec2 dir = vec2(cos(ang), sin(ang));
153 float fringe = sin(dot(p, dir) * (40.0 +
h * 80.0) + t * (1.0 +
h * 4.0));
154 fringe = pow(fringe * 0.5 + 0.5, 4.0);
155 fluid += dir * fringe * 0.04 * (1.0 +
h);
158 c.r =
cacheHist(i, fluid + vec2(
h * 0.012, 0.0)).r;
160 c.b =
cacheHist(i, fluid - vec2(
h * 0.012, 0.0)).b;
162 vec3
neon =
palette(length(q) + length(r) +
float(i) * 0.13, vec3(0.0, 0.33, 0.66));
163 return c *
neon * 2.2 +
neon * fringe * 0.4;
170 float t =
iTime * 0.6;
171 vec3 acc = vec3(0.0);
172 for (
int i = 0; i < 8; i++) {
173 float h =
specHist(i, 0.05 +
float(i) * 0.06);
181 vec2 vUV = tc * (1.0 - tc.yx);
182 float vig = pow(vUV.x * vUV.y * 15.0, 0.2);
183 acc = mix(vec3(0.05, 0.0, 0.1), acc * vig, vig);
185 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.
float fbm(vec2 point)
Evaluates fbm for this shader effect.
#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 hash(vec2 p)
Evaluates hash 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 vnoise(vec2 p)
Evaluates vnoise for this shader effect.
vec3 sampleLiquidSlot(int i, vec2 uv, float t, float h, float h2)
Evaluates sampleLiquidSlot for this shader effect.
vec3 neon(float t)
Evaluates neon for this shader effect.
float h(vec2 p)
Evaluates h for this shader effect.