7layout(set = 0, binding = 1, std140) uniform SpriteExtended {
13 vec4 custom_uniforms[16];
17#define amp_high ext.audio_bands.z
18#define amp_low ext.audio_bands.x
19#define amp_mid ext.audio_bands.y
20#define amp_peak ext.u2.w
21#define amp_smooth ext.u3.w
22#define iResolution ext.u0.zw
23#define time_f ext.u2.y
26layout(location = 0) out vec4 color;
27layout(set = 0, binding = 0) uniform sampler2D samp;
36const
float PI = 3.14159265359;
37const
float TAU = 6.28318530718;
45 p = fract(p * vec2(443.8975, 397.2973));
46 p += dot(p, p.yx + 19.19);
47 return fract((p.x + p.y) * p.x);
57 vec2 local = fract(p);
58 local = local * local * (3.0 - 2.0 * local);
71 float amplitude = 0.52;
72 mat2
twist = mat2(0.64, -0.77, 0.77, 0.64);
73 for (
int i = 0; i < 6; ++i) {
74 result +=
noise21(p) * amplitude;
75 p =
twist * p * 2.06 + vec2(1.37, 4.11);
87 return 1.0 - abs(mod(uv, 2.0) - 1.0);
96 vec3 cold = vec3(0.025, 0.055, 0.11);
97 vec3 copper = vec3(0.92, 0.20, 0.035);
98 vec3 gold = vec3(1.0, 0.68, 0.16);
99 vec3 white = vec3(1.0, 0.94, 0.78);
100 vec3 result = mix(cold, copper, smoothstep(0.05, 0.46, x));
101 result = mix(result, gold, smoothstep(0.42, 0.72, x));
102 return mix(result, white, smoothstep(0.72, 1.0, x));
111 return 0.5 + 0.5 * cos(
TAU * (x + vec3(0.0, 0.31, 0.65)));
121 vec2 centers[2] = vec2[2](vec2(-0.22, 0.0), vec2(0.22, 0.0));
123 for (
int i = 0; i < 2; ++i) {
124 vec2 d = p - centers[i];
125 float r = max(length(d), 0.025);
126 float a = atan(d.y, d.x);
127 float handedness = (i == 0) ? 1.0 : -1.0;
128 float coil = a * 4.0 * handedness + log(r) * 8.5 - t * (1.8 + float(i) * 0.25);
129 field += sin(coil + r * 24.0) * exp(-r * 1.25) * 0.3;
130 field += cos(coil * 2.0 - r * 11.0) * exp(-r * 2.3) * 0.1;
134 float warp0 =
flowFbm(q * 3.4 + vec2(t * 0.12, -t * 0.1));
135 float warp1 =
flowFbm(q * 3.4 + vec2(-t * 0.09, t * 0.13) + 9.7);
136 q += (vec2(warp0, warp1) - 0.5) * 0.23;
137 float viscosity =
flowFbm(q * 7.0 + vec2(t * 0.14, -t * 0.11));
138 float crossWave = sin(q.y * 32.0 + sin(q.x * 9.0 - t) * 3.0 - t * 4.6);
139 return field + viscosity * 0.58 + crossWave * 0.075;
153 vec2 gradient = vec2(right - left, up - down) / (2.0 * e);
154 return normalize(vec3(-gradient * 0.1, 1.0));
163 vec2 centers[2] = vec2[2](vec2(-0.22, 0.0), vec2(0.22, 0.0));
164 vec2 velocity = vec2(0.0);
165 for (
int i = 0; i < 2; ++i) {
166 vec2 d = p - centers[i];
167 float r2 = dot(d, d) + 0.025;
168 float handedness = (i == 0) ? 1.0 : -1.0;
169 velocity += vec2(-d.y, d.x) * handedness / r2;
183 vec2 direction = normalize(velocity + normalDirection * 0.8 + vec2(0.0001));
184 vec2 across = vec2(-direction.y, direction.x);
185 vec3 smear = texture(samp,
mirrorUV(uv)).rgb * 0.4;
186 smear += texture(samp,
mirrorUV(uv + direction * 0.004)).rgb * 0.24;
187 smear += texture(samp,
mirrorUV(uv - direction * 0.004)).rgb * 0.24;
188 smear += texture(samp,
mirrorUV(uv + across * 0.0025)).rgb * 0.06;
189 smear += texture(samp,
mirrorUV(uv - across * 0.0025)).rgb * 0.06;
190 return vec3(texture(samp,
mirrorUV(uv + across * split)).r,
192 texture(samp,
mirrorUV(uv - across * split)).b);
204 return pow(max(dot(
n, normalize(v + l)), 0.0), power);
216 vec3 view = normalize(vec3(-p * 0.11, 1.4));
217 vec3 key = normalize(vec3(-0.62, 0.48, 0.73));
218 vec3 fill = normalize(vec3(0.71, 0.34, 0.61));
219 vec3 rim = normalize(vec3(0.08, -0.78, 0.62));
220 float nv = max(dot(
n, view), 0.0);
221 vec3 f0 = mix(vec3(0.66), base, 0.55);
222 vec3 fresnel = f0 + (1.0 - f0) * pow(1.0 - nv, 5.0);
223 vec3 reflected = reflect(-view,
n);
224 vec3 environment = mix(vec3(0.018, 0.028, 0.06),
226 smoothstep(-0.55, 0.8, reflected.z));
228 vec3 result = base * (0.035 + 0.08 * max(dot(
n, key), 0.0));
229 result += fresnel * environment * 1.2;
230 result +=
specularLobe(
n, view, key, 150.0) * vec3(1.0, 0.7, 0.36) * 2.6;
231 result +=
specularLobe(
n, view, fill, 55.0) * vec3(0.35, 0.62, 1.0) * 1.2;
232 result +=
specularLobe(
n, view, rim, 24.0) * vec3(0.9, 0.2, 0.08) * 0.75;
242 value = max(value, 0.0);
243 return 1.0 - exp(-value * (1.03 + value * 0.1));
251 vec2 p = (tc - 0.5) * vec2(aspect, 1.0);
256 velocity = velocity / (1.0 + length(velocity) * 2.2);
258 float flowStrength = 0.042 +
amp_low * 0.025;
259 vec2 flow = velocity * flowStrength +
n.xy * (0.017 +
amp_smooth * 0.016);
260 flow += vec2(sin(p.y * 12.0 -
time_f * 1.8), cos(p.x * 11.0 +
time_f * 1.5)) * 0.004;
261 vec2 uv =
mirrorUV(tc + flow / vec2(aspect, 1.0));
263 float split = 0.0018 +
amp_high * 0.006;
265 float luminance = dot(source, vec3(0.299, 0.587, 0.114));
266 vec3
alloy = mix(vec3(
luminance) * vec3(0.86, 0.79, 0.72), source, 0.42);
267 float heat = smoothstep(0.36, 0.92,
flowFbm(p * 5.0 - vec2(
time_f * 0.1, 0.0)));
270 float vein = pow(0.5 + 0.5 * sin(height * 12.0 -
time_f * 2.8), 12.0);
271 vec3 emission =
heatPalette(clamp(heat + vein * 0.35, 0.0, 1.0));
272 result += emission * vein * (0.28 +
amp_peak * 1.35);
274 result = mix(result, result * (0.6 + source), 0.2);
layout(set=0, binding=1, std140) uniform SpriteExtended
void main(void)
Executes the fragment shader entry point.
vec2 mirrorUV(vec2 uv)
Evaluates mirrorUV for this shader effect.
vec3 spectral(float t)
Evaluates spectral for this shader effect.
float hash21(vec2 p)
Evaluates hash21 for this shader effect.
float n(vec2 p)
Evaluates n for this shader effect.
float field(vec2 p, float tm)
Evaluates field for this shader effect.
float luminance(vec3 c)
Evaluates luminance for this shader effect.
float noise21(vec2 p)
Evaluates noise21 for this shader effect.
vec2 cell(vec2 p)
Evaluates cell for this shader effect.
vec3 toneMap(vec3 value)
Evaluates toneMap for this shader effect.
float flowFbm(vec2 p)
Evaluates flowFbm for this shader effect.
float specularLobe(vec3 n, vec3 v, vec3 l, float power)
Evaluates specularLobe for this shader effect.
vec3 advectedTexture(vec2 uv, vec2 velocity, vec2 normalDirection, float split)
Evaluates advectedTexture for this shader effect.
vec2 helixVelocity(vec2 p)
Evaluates helixVelocity for this shader effect.
vec3 liquidNormal(vec2 p, float e)
Evaluates liquidNormal for this shader effect.
float helixPotential(vec2 p)
Evaluates helixPotential for this shader effect.
vec3 heatPalette(float x)
Evaluates heatPalette for this shader effect.
vec3 moltenLighting(vec3 base, vec3 n, vec2 p, float heat)
Evaluates moltenLighting for this shader effect.
vec2 twist(vec2 coord, float twistAmount, float time, float direction)
Evaluates twist for this shader effect.