211 vec2 warped = p + vec2(
fbm(p * 2.0 + t * 0.035),
fbm(p * 2.0 + 8.0 - t * 0.03)) * 0.23;
212 vec2 grid = warped * (5.0 + band.y * 3.0);
213 vec2
id = floor(grid);
214 vec2 local = fract(grid);
217 vec2 direction = vec2(0.0);
218 for (
int y = -1; y <= 1; ++y) {
219 for (
int x = -1; x <= 1; ++x) {
220 vec2 neighbor = vec2(
float(x),
float(y));
221 vec2 point = 0.5 + 0.4 * sin(
TAU *
hash22(
id + neighbor) + t * 0.12 + age);
222 vec2 delta = neighbor + point - local;
223 float distanceToPoint = length(delta);
224 if (distanceToPoint < nearest) {
226 nearest = distanceToPoint;
228 }
else if (distanceToPoint < second) {
229 second = distanceToPoint;
233 float boundary = exp(-(second - nearest) * (18.0 + band.z * 34.0));
234 float roomTone = 0.5 + 0.5 * sin(
hash21(
id) *
TAU + t * 0.18 - age * 0.4);
235 return vec3(boundary * 0.75 + roomTone * 0.25, normalize(direction + vec2(0.001)) * boundary);
243 vec2 aspectScale = vec2(aspect, 1.0);
244 vec2 p = (tc - 0.5) * aspectScale;
245 float eccentricity = smoothstep(0.06, 0.92, length(p));
246 vec3 live = texture(samp, tc).rgb;
248 vec3 accumulation = live * 0.42;
249 float totalWeight = 0.42;
252 float temporalDelta = length(newest - oldest);
254 for (
int index = 0; index < 8; ++index) {
255 float age = float(index);
259 vec2 flow = clamp(
field.yz, vec2(-2.0), vec2(2.0));
261 float breathing = 1.0 + sin(
clockTime() * 0.21 - age * 0.16) * (0.006 + bands.x * 0.018);
262 vec2 historyUV = (tc - 0.5) * breathing + 0.5;
263 float peripheralGain = mix(0.45, 1.0, eccentricity);
264 historyUV += flow / aspectScale *
DISTORTION * (0.007 + bands.y * 0.018) * peripheralGain;
267 vec3 cached =
cacheFrame(index, historyUV).rgb;
268 vec3 afterimage = mix(cached, cached.gbr, 0.10 + age * 0.025);
271 float luminous = pow(clamp(
energy, 0.0, 1.0), 2.0);
272 vec3 layer = mix(afterimage, afterimage * fieldColor * 1.18, 0.44);
273 layer += fieldColor * luminous * (0.10 + bands.z * 0.48);
275 float weight = pow(
PERSISTENCE, age + 1.0) * (0.46 + bands.x * 0.66 + bands.y * 0.34);
276 accumulation += layer * weight;
277 totalWeight += weight;
280 vec3 result = accumulation / max(totalWeight, 0.001);
282 float currentEnergy = clamp(abs(currentField.x), 0.0, 1.4);
285 float aura = pow(clamp(currentEnergy, 0.0, 1.0), 2.5);
286 float fieldEdge = fwidth(currentField.x);
288 result = 1.0 - (1.0 - result) * (1.0 - clamp(auraColor * aura * 0.28, 0.0, 0.72));
289 result += auraColor * fieldEdge * (1.1 + newest.w * 2.2);
290 result = mix(result, live, 0.10 * (1.0 - eccentricity));
291 result *= 1.0 + clamp(
amp_smooth, 0.0, 1.0) * 0.16;
295 smoothstep(0.72, 0.98,
amp_peak) * smoothstep(0.06, 0.48, temporalDelta) * 0.64;
296 vec3 inverted = mix(vec3(1.0) - result, (vec3(1.0) - result).brg, 0.24);
297 result = mix(result, inverted, inversion);
298 color = vec4(clamp(result, 0.0, 1.0), texture(samp, tc).a);