125 vec3 center = textureGrad(samp, uv, dx, dy).rgb;
126 vec3 axial = textureGrad(samp,
mirrorUV(uv + vec2(px.x, 0.0)), dx, dy).rgb;
127 axial += textureGrad(samp,
mirrorUV(uv - vec2(px.x, 0.0)), dx, dy).rgb;
128 axial += textureGrad(samp,
mirrorUV(uv + vec2(0.0, px.y)), dx, dy).rgb;
129 axial += textureGrad(samp,
mirrorUV(uv - vec2(0.0, px.y)), dx, dy).rgb;
130 return center * 0.60 + axial * 0.10;
138 float bass = clamp(
amp_low, 0.0, 1.0);
139 float mids = clamp(
amp_mid, 0.0, 1.0);
140 float highs = clamp(
amp_high, 0.0, 1.0);
144 vec2 ar = vec2(aspect, 1.0);
145 vec2 local = (tc - center) * ar;
146 float radius = length(local);
147 float angle = atan(local.y, local.x);
151 vec2 fp = (folded - center) * ar;
152 float diamond = max(abs(fp.x), abs(fp.y));
154 float spiral = sin(angle * (2.0 + 0.25 *
SEGMENTS) + radius * 18.0 - t * 2.2);
159 wave = 0.62 * ring + 0.38 * sin(radius * 28.0 - t * 2.6);
160 }
else if (
STYLE == 2) {
161 wave = 0.68 * spiral + 0.32 * ring;
162 }
else if (
STYLE == 3) {
164 }
else if (
STYLE == 4) {
165 wave = 0.45 * ring + 0.35 *
lattice + 0.20 * spiral;
168 vec2 normalField = vec2(dFdx(
wave), dFdy(
wave));
169 float normalLength = max(length(normalField), 1e-4);
170 normalField /= normalLength;
171 vec2 radial = local / max(radius, 1e-4) / ar;
172 vec2 tangent = vec2(-radial.y, radial.x / max(aspect, 1e-4));
173 float envelope = smoothstep(1.15, 0.05, radius);
174 float audioPush = 1.0 + bass * 0.28 +
energy * 0.16;
175 vec2 displacement = (normalField * 0.58 + radial *
wave * 0.30 + tangent * spiral * 0.12);
176 displacement *=
DISTORTION * envelope * audioPush;
177 displacement.x /= max(aspect, 1.0);
179 vec2 warpedUV = tc + displacement;
180 vec2 chroma = normalField * (0.0007 + highs * 0.0013) * envelope;
181 chroma.x /= max(aspect, 1.0);
183 warped.r =
sampleHQ(warpedUV + chroma).r;
185 warped.b =
sampleHQ(warpedUV - chroma).b;
188 vec2 foldDetail = folded + normalField *
DISTORTION * 0.22;
190 foldedLayer.r =
sampleHQ(foldDetail + chroma * 1.5).r;
191 foldedLayer.g =
sampleHQ(foldDetail).g;
192 foldedLayer.b =
sampleHQ(foldDetail - chroma * 1.5).b;
194 vec3 original = texture(samp, tc).rgb;
195 float detail = 0.5 + 0.5 *
wave;
196 float aa = max(fwidth(
wave), 0.001);
197 float facet = smoothstep(0.42 - aa, 0.42 + aa, detail);
199 vec3 fractalOverlap = mix(warped, foldedLayer, 0.58 + 0.08 * mids);
200 vec3 treated = mix(fractalOverlap, fractalOverlap * tint, 0.30 + 0.12 *
energy);
201 float facetEdge = 1.0 - smoothstep(0.0, 0.10 + aa * 2.0, abs(detail - 0.42));
202 treated += tint * facetEdge * (0.035 + 0.025 *
energy);
203 treated += (fractalOverlap - original) * (0.14 + 0.07 * mids);
205 float centerFade = smoothstep(0.015, 0.13, radius);
206 float blendAmount =
EFFECT_MIX * centerFade * (0.92 + 0.08 * sin(t + radius * 5.0));
207 blendAmount *= 1.0 + 0.10 * clamp(
amp_peak, 0.0, 1.0);
209 vec3 lowOverlay = 2.0 * original * treated;
210 vec3 highOverlay = 1.0 - 2.0 * (1.0 - original) * (1.0 - treated);
211 vec3 overlay = mix(lowOverlay, highOverlay, step(vec3(0.5), original));
212 vec3 layered = mix(treated, overlay, 0.24);
213 vec3 finalRGB = mix(original, layered, clamp(blendAmount, 0.0, 0.68));
214 color = vec4(clamp(finalRGB, 0.0, 1.0), texture(samp, tc).a);