# @description An original sixty-second study of a luminous software-raytraced dream in five dissolves: light corridor, planet garden, living totem, magenta vessel and liquid. # @tags raytracing, cinematic # HEAVEN 7 — an original sixty-second study of a luminous software-raytraced dream. # Five dissolves: light corridor / planet garden / living totem / magenta vessel / liquid. # 24 bars at 96 BPM. All geometry, choreography, text and music are original to this file. title HEAVEN 7 song bpm=96 speed=6 rpb=4 channels=8 loop=23 volume=0.64 scale=2 dither=1 order 0 0 1 2 3 0 1 4 5 2 3 6 7 0 1 4 5 2 3 6 7 0 1 8 pan 0.50 0.48 0.44 0.56 0.50 0.34 0.66 0.52 text heading "HEAVEN 7" text credit "after exceed, 2000" text phraseA "the newborn." text phraseB "a place like heaven" text phraseC "waking, weightless" # ----------------------------------------------------------------------- sound inst heart { f = 47 + 105 * exp(-t * 16) $phase = $phase + f / sr body = sin($phase * tau) * exp(-t * 5.0) air = lp(noise(), 420) * exp(-t * 24) * 0.10 out(dist(body * 1.25 + air, 1.16) * 0.46) } inst bass { e = env(0.055, 0.42, 0.68, 0.72) s = sin(ph * tau) + sin(ph * tau * 2.002) * 0.12 + tri(ph) * 0.10 s = lp(s, 145 + 260 * e) out(s * e * 0.36) } inst pad nna=continue { e = env(0.72, 1.10, 0.78, 2.50) s = usaw(freq, 0.15) * 0.55 + sin(ph * tau) * 0.52 + tri(ph + 0.001 * t) * 0.12 opening = 390 + 720 * smooth(5, 44, time) + 150 * sin(time * 0.19) s = svf(s, opening + 300 * e, 0.34) out(s * e * 0.19) } inst padMiddle nna=continue { e = env(0.86, 1.0, 0.76, 2.7) s = usaw(freq, 0.20) * 0.48 + sin(ph * tau) * 0.55 + tri(ph - 0.0013 * t) * 0.13 s = svf(s, 460 + 760 * smooth(7, 45, time) + 260 * e, 0.38) out(s * e * 0.18) } inst padHigh nna=continue { e = env(1.0, 1.2, 0.74, 2.9) s = usaw(freq, 0.12) * 0.44 + sin(ph * tau) * 0.50 + sin(ph * tau * 2.002) * 0.09 s = svf(s, 520 + 820 * smooth(9, 46, time) + 240 * e, 0.42) out(s * e * 0.17) } inst bell { e = exp(-t * 1.32) * smooth(0, 0.006, t) m = sin(ph * tau * 2.007) * (1.15 * exp(-t * 2.7) + 0.08) s = sin(ph * tau + m) + sin(ph * tau * 2.004 + m * 0.18) * 0.25 s = s + sin(ph * tau * 3.993) * exp(-t * 4.8) * 0.11 out(s * e * 0.22) } inst glass { e = exp(-t * 2.15) * smooth(0, 0.004, t) m = sin(ph * tau * 1.501) * exp(-t * 3.8) * 0.85 s = sin(ph * tau + m) + sin(ph * tau * 3.01) * 0.16 out(s * e * 0.18) } inst air nna=continue { e = env(1.8, 2.0, 0.72, 3.0) n = svf(noise(), 900 + 1000 * e + 260 * sin(time * 0.23), 0.76) s = r2 * 0.35 + sin(ph * tau) * 0.045 out(s * e * 0.15) } chan 5 { d = dly(x, 0.46875, 0.34) w = verb(x + d * 0.12, 0.88, 0.42) out(x * 0.80 + d * 0.34 + w * 0.48) } chan 6 { d = dly(x, 0.703125, 0.30) w = verb(x, 0.86, 0.48) out(x * 0.86 + d * 0.27 + w * 0.38) } master { dl = dly(l, 0.9375, 0.20) dr = dly(r, 0.625, 0.22) vl = verb(l + dr * 0.10, 0.87, 0.46) vr = verb(r + dl * 0.10, 0.87, 0.46) # A tiny, slowly breathing room tone keeps the silences spacious, not empty. room = lp(noise(), 650) * (0.004 + 0.001 * sin(time * 0.31)) ol = hp(l + dr * 0.13 + vl * 0.20 + room, 28) or = hp(r + dl * 0.13 + vr * 0.20 + room, 28) out(dist(ol * 1.05, 1.15), dist(or * 1.05, 1.15)) } # Score: Cmaj9 / Am9 / Fmaj9 / Gsus2 / Em7 / Dm9 / Bbmaj9 / Gadd9. # The arpeggios and bell answers are newly composed for this study. pattern 0 rows=16 { 00: C-2 1 16 ... | C-1 2 24 ... | C-3 3 20 ... | E-3 4 1C ... | G-3 5 1C ... | E-6 6 14 ... | C-5 7 12 ... | C-4 8 20 ... 01: . | . | . | . | . | . | . | . 02: . | . | . | . | . | . | G-5 7 10 ... | . 03: . | . | . | . | . | B-5 6 10 ... | . | . 04: . | . | . | . | . | . | E-6 7 0E ... | . 05: . | . | . | . | . | . | . | . 06: . | . | . | . | . | G-6 6 12 ... | D-6 7 10 ... | . 07: . | . | . | . | . | . | . | . 08: C-2 1 13 ... | C-1 2 20 ... | . | . | . | . | G-5 7 0E ... | . 09: . | . | . | . | . | . | . | . 10: . | . | . | . | . | D-6 6 11 ... | E-6 7 10 ... | . 11: . | . | . | . | . | . | . | . 12: . | . | . | . | . | . | B-5 7 0D ... | . 13: . | . | . | . | . | . | . | . 14: . | . | . | . | . | B-5 6 0E ... | G-5 7 0C ... | . 15: . | . | . | . | . | . | . | . } pattern 1 rows=16 { 00: C-2 1 15 ... | A-0 2 25 ... | A-2 3 20 ... | C-3 4 1D ... | E-3 5 1C ... | C-6 6 14 ... | A-5 7 12 ... | A-3 8 1E ... 01: . | . | . | . | . | . | . | . 02: . | . | . | . | . | . | E-6 7 10 ... | . 03: . | . | . | . | . | E-6 6 10 ... | . | . 04: . | . | . | . | . | . | B-5 7 0F ... | . 05: . | . | . | . | . | . | . | . 06: . | . | . | . | . | A-6 6 12 ... | C-6 7 10 ... | . 07: . | . | . | . | . | . | . | . 08: C-2 1 12 ... | A-0 2 20 ... | . | . | . | . | E-6 7 0E ... | . 09: . | . | . | . | . | . | . | . 10: . | . | . | . | . | G-6 6 11 ... | B-5 7 10 ... | . 11: . | . | . | . | . | . | . | . 12: . | . | . | . | . | . | A-5 7 0D ... | . 13: . | . | . | . | . | . | . | . 14: . | . | . | . | . | E-6 6 0F ... | C-6 7 0D ... | . 15: . | . | . | . | . | . | . | . } pattern 2 rows=16 { 00: C-2 1 17 ... | F-0 2 26 ... | F-2 3 21 ... | A-2 4 1D ... | C-3 5 1D ... | A-5 6 15 ... | F-5 7 12 ... | F-3 8 20 ... 01: . | . | . | . | . | . | . | . 02: . | . | . | . | . | . | C-6 7 11 ... | . 03: . | . | . | . | . | E-6 6 11 ... | . | . 04: C-2 1 11 ... | . | . | . | . | . | G-5 7 0F ... | . 05: . | . | . | . | . | . | . | . 06: . | . | . | . | . | C-6 6 13 ... | A-5 7 11 ... | . 07: . | . | . | . | . | . | . | . 08: . | . | F-0 2 21 ... | . | . | . | E-6 7 0F ... | . 09: . | . | . | . | . | . | . | . 10: C-2 1 12 ... | . | . | . | . | G-5 6 12 ... | C-6 7 11 ... | . 11: . | . | . | . | . | . | . | . 12: . | . | . | . | . | . | G-5 7 0E ... | . 13: . | . | . | . | . | . | . | . 14: . | . | . | . | . | A-5 6 10 ... | F-5 7 0D ... | . 15: . | . | . | . | . | . | . | . } pattern 3 rows=16 { 00: . | G-0 2 25 ... | G-2 3 20 ... | D-3 4 1D ... | A-3 5 1C ... | D-6 6 14 ... | G-5 7 12 ... | G-3 8 1E ... 01: . | . | . | . | . | . | . | . 02: . | . | . | . | . | . | A-5 7 10 ... | . 03: . | . | . | . | . | A-5 6 10 ... | . | . 04: C-2 1 12 ... | . | . | . | . | . | D-6 7 0E ... | . 05: . | . | . | . | . | . | . | . 06: . | . | . | . | . | G-6 6 12 ... | G-5 7 10 ... | . 07: . | . | . | . | . | . | . | . 08: . | . | G-0 2 20 ... | . | . | . | A-5 7 0E ... | . 09: . | . | . | . | . | . | . | . 10: . | . | . | . | . | E-6 6 11 ... | D-6 7 10 ... | . 11: . | . | . | . | . | . | . | . 12: C-2 1 11 ... | . | . | . | . | . | A-5 7 0D ... | . 13: . | . | . | . | . | . | . | . 14: . | . | . | . | . | D-6 6 0E ... | G-5 7 0C ... | . 15: . | . | . | . | . | . | . | . } pattern 4 rows=16 { 00: C-2 1 18 ... | E-0 2 27 ... | E-2 3 22 ... | G-2 4 1F ... | D-3 5 1E ... | G-5 6 16 ... | E-5 7 13 ... | E-3 8 20 ... 01: . | . | . | . | . | . | . | . 02: . | . | . | . | . | . | B-5 7 11 ... | . 03: . | . | . | . | . | B-5 6 11 ... | . | . 04: . | . | . | . | . | . | D-6 7 10 ... | . 05: . | . | . | . | . | . | . | . 06: C-2 1 12 ... | . | . | . | . | E-6 6 14 ... | G-5 7 11 ... | . 07: . | . | . | . | . | . | . | . 08: . | . | E-0 2 22 ... | . | . | . | B-5 7 0F ... | . 09: . | . | . | . | . | . | . | . 10: . | . | . | . | . | D-6 6 12 ... | E-6 7 11 ... | . 11: . | . | . | . | . | . | . | . 12: C-2 1 12 ... | . | . | . | . | . | G-5 7 0E ... | . 13: . | . | . | . | . | . | . | . 14: . | . | . | . | . | B-5 6 11 ... | D-6 7 0E ... | . 15: . | . | . | . | . | . | . | . } pattern 5 rows=16 { 00: C-2 1 17 ... | D-1 2 26 ... | D-2 3 22 ... | F-2 4 1E ... | A-2 5 1E ... | A-5 6 15 ... | D-5 7 13 ... | D-3 8 20 ... 01: . | . | . | . | . | . | . | . 02: . | . | . | . | . | . | F-5 7 11 ... | . 03: . | . | . | . | . | F-5 6 11 ... | . | . 04: . | . | . | . | . | . | A-5 7 10 ... | . 05: . | . | . | . | . | . | . | . 06: C-2 1 12 ... | . | . | . | . | D-6 6 13 ... | E-5 7 11 ... | . 07: . | . | . | . | . | . | . | . 08: . | . | D-1 2 22 ... | . | . | . | A-5 7 0F ... | . 09: . | . | . | . | . | . | . | . 10: . | . | . | . | . | E-6 6 12 ... | C-6 7 11 ... | . 11: . | . | . | . | . | . | . | . 12: . | . | . | . | . | . | A-5 7 0E ... | . 13: . | . | . | . | . | . | . | . 14: C-2 1 11 ... | . | . | . | . | F-5 6 11 ... | E-5 7 0D ... | . 15: . | . | . | . | . | . | . | . } pattern 6 rows=16 { 00: C-2 1 18 ... | A#0 2 28 ... | A#2 3 23 ... | D-3 4 20 ... | F-3 5 1F ... | D-6 6 17 ... | F-5 7 14 ... | A#2 8 22 ... 01: . | . | . | . | . | . | . | . 02: . | . | . | . | . | . | A-5 7 12 ... | . 03: . | . | . | . | . | F-6 6 12 ... | . | . 04: . | . | . | . | . | . | C-6 7 11 ... | . 05: . | . | . | . | . | . | . | . 06: C-2 1 13 ... | . | . | . | . | A-6 6 14 ... | D-6 7 12 ... | . 07: . | . | . | . | . | . | . | . 08: . | . | A#0 2 23 ... | . | . | . | A-5 7 10 ... | . 09: . | . | . | . | . | . | . | . 10: . | . | . | . | . | G-6 6 13 ... | F-6 7 12 ... | . 11: . | . | . | . | . | . | . | . 12: C-2 1 12 ... | . | . | . | . | . | C-6 7 0F ... | . 13: . | . | . | . | . | . | . | . 14: . | . | . | . | . | F-6 6 12 ... | D-6 7 0E ... | . 15: . | . | . | . | . | . | . | . } pattern 7 rows=16 { 00: C-2 1 18 ... | G-0 2 28 ... | G-2 3 23 ... | B-2 4 20 ... | D-3 5 1F ... | B-5 6 17 ... | G-5 7 14 ... | G-2 8 22 ... 01: . | . | . | . | . | . | . | . 02: . | . | . | . | . | . | D-6 7 12 ... | . 03: . | . | . | . | . | D-6 6 12 ... | . | . 04: . | . | . | . | . | . | A-5 7 11 ... | . 05: . | . | . | . | . | . | . | . 06: C-2 1 13 ... | . | . | . | . | G-6 6 14 ... | B-5 7 12 ... | . 07: . | . | . | . | . | . | . | . 08: . | . | G-0 2 23 ... | . | . | . | D-6 7 10 ... | . 09: . | . | . | . | . | . | . | . 10: . | . | . | . | . | A-6 6 13 ... | A-5 7 12 ... | . 11: . | . | . | . | . | . | . | . 12: C-2 1 12 ... | . | . | . | . | . | B-5 7 0F ... | . 13: . | . | . | . | . | . | . | . 14: . | . | . | . | . | B-5 6 12 ... | D-6 7 0E ... | . 15: . | . | . | . | . | . | . | . } pattern 8 rows=16 { 00: C-2 1 14 ... | C-1 2 25 ... | C-3 3 23 ... | E-3 4 21 ... | G-3 5 21 ... | E-6 6 17 ... | C-6 7 15 ... | C-4 8 22 ... 01: . | . | . | . | . | . | . | . 02: . | . | . | . | . | . | G-5 7 12 ... | . 03: . | . | . | . | . | G-6 6 12 ... | . | . 04: . | . | . | . | . | . | B-5 7 11 ... | . 05: . | . | . | . | . | . | . | . 06: . | . | . | . | . | B-5 6 13 ... | D-6 7 12 ... | . 07: . | . | . | . | . | . | . | . 08: C-2 1 12 ... | C-1 2 21 ... | . | . | . | . | E-6 7 11 ... | . 09: . | . | . | . | . | . | . | . 10: . | . | . | . | . | D-6 6 13 ... | G-6 7 12 ... | . 11: . | . | . | . | . | . | . | . 12: . | . | . | . | . | . | E-6 7 10 ... | . 13: . | . | . | . | . | E-6 6 12 ... | . | . 14: C-2 1 10 ... | . | . | . | . | C-7 6 14 ... | G-6 7 12 ... | . 15: . | . | . | . | . | . | . | . } # ------------------------------------------------------------------- helpers fn box3(px, py, pz, bx, by, bz) { qx = abs(px) - bx qy = abs(py) - by qz = abs(pz) - bz return len(len(max(qx, 0), max(qy, 0)), max(qz, 0)) + min(max(qx, max(qy, qz)), 0) } fn seg2(px, py, ax, ay, bx, by) { vx = bx - ax vy = by - ay k = clamp(((px - ax) * vx + (py - ay) * vy) / (vx * vx + vy * vy + 0.00001), 0, 1) return len(px - ax - vx * k, py - ay - vy * k) } fn softmin(a, b, k) { hh = clamp(0.5 + 0.5 * (b - a) / k, 0, 1) return mix(b, a, hh) - k * hh * (1 - hh) } fn word(s, py, sz) { cx = (u + strlen(s) * sz * 0.5) / sz cy = (py - v) / sz return glyph(str(s, floor(cx)), fract(cx), fract(cy)) * step(0, cx) * step(cx, strlen(s)) * step(0, cy) * step(cy, 1) } fn tracked(s, py, sz, tracking) { n = strlen(s) cx = (u + n * tracking * sz * 0.5) / (sz * tracking) cy = (py - v) / sz i = floor(cx) gx = fract(cx) * tracking return glyph(str(s, i), gx, fract(cy)) * step(0, cx) * step(cx, n) * step(0, cy) * step(cy, 1) } fn starfield(dx, dy, dz, drift) { den = max(-dz, 0.28) sx = dx / den sy = dy / den ax = sx * 95 + drift * 1.7 ay = sy * 68 - drift * 0.4 ah = hash(floor(ax) + floor(ay) * 127.1) ap = len(fract(ax) - 0.5, fract(ay) - 0.5) near = step(0.990, ah) * exp(-ap * 8.0) * (0.72 + 0.28 * sin(time * (0.7 + ah) + ah * 50)) bx = sx * 163 - drift * 4.2 by = sy * 117 + drift * 0.9 bh = hash(floor(bx) + floor(by) * 173.7 + 19) bp = len(fract(bx) - 0.5, fract(by) - 0.5) far = step(0.994, bh) * exp(-bp * 13.0) * (0.70 + 0.30 * sin(time * 0.55 + bh * 40)) return near * 0.90 + far * 0.58 } fn figure2(px, py, phase) { d = len(px * 1.05, (py - 0.245) * 0.92) - 0.052 d = softmin(d, seg2(px, py, 0, 0.18, 0, -0.055) - 0.055, 0.025) swing = sin(phase) * 0.045 d = min(d, seg2(px, py, -0.025, -0.04, -0.042 - swing, -0.25) - 0.018) d = min(d, seg2(px, py, 0.025, -0.04, 0.042 + swing, -0.25) - 0.018) d = min(d, seg2(px, py, -0.042, 0.135, -0.09 + swing, -0.025) - 0.014) d = min(d, seg2(px, py, 0.042, 0.135, 0.09 - swing, -0.02) - 0.014) return d } # ---------------------------------------------------------- shared choreography uniform scene blend bellE heartE padE frame { scene = 0 if (time >= 12) { scene = 1 } if (time >= 28) { scene = 2 } if (time >= 42) { scene = 3 } if (time >= 50) { scene = 4 } select(scene) bellE = exp(-trig(5) * 2.0) heartE = exp(-trig(0) * 5.0) * step(0.01, vel(0)) padE = cenv(2) } # ---------------------------------------------------------- I. the light corridor pixel corridor { dx = u * 1.30 dy = v * 1.30 + 0.035 + 0.003 * sin(time * 0.31) dz = 1 tf = 10000 tc = 10000 tw = 10000 if (dy < -0.0001) { tf = -1.50 / dy } if (dy > 0.0001) { tc = 1.90 / dy } if (abs(dx) > 0.0001) { tw = 2.15 * sign(dx) / dx } tb = 18.0 ht = min(min(tf, tc), min(tw, tb)) px = dx * ht py = 1.50 + dy * ht pz = dz * ht cloud = fbm(dx * 2.4 + time * 0.018, dy * 3.2 - time * 0.012, 4) haze = exp(-ht * 0.037) # White ceramic architecture, blue light leaking through its seams. cr = 0.56 + cloud * 0.16 cg = 0.68 + cloud * 0.18 cb = 0.82 + cloud * 0.20 if (ht == tf) { tileX = exp(-abs(fract(px * 0.52) - 0.5) * 42) tileZ = exp(-abs(fract(pz * 0.36) - 0.5) * 46) sheen = 0.5 + 0.5 * sin(px * 0.7 + pz * 0.16) cr = 0.29 + sheen * 0.08 + (tileX + tileZ) * 0.20 cg = 0.43 + sheen * 0.10 + (tileX + tileZ) * 0.22 cb = 0.58 + sheen * 0.13 + (tileX + tileZ) * 0.25 } else { ribs = exp(-abs(fract(pz / 3.0) - 0.5) * 65) panel = exp(-abs(fract((py + px * 0.07) * 0.55) - 0.5) * 52) cr = cr + ribs * 0.28 + panel * 0.07 cg = cg + ribs * 0.30 + panel * 0.09 cb = cb + ribs * 0.34 + panel * 0.12 } if (ht == tb) { cr = 0.50 + cloud * 0.48 cg = 0.69 + cloud * 0.35 cb = 0.91 + cloud * 0.22 } vanish = exp(-len(dx * 1.4, (dy - 0.04) * 1.8) * 4.5) cr = mix(0.76, cr, haze) + vanish * 0.18 cg = mix(0.88, cg, haze) + vanish * 0.19 cb = mix(1.00, cb, haze) + vanish * 0.20 # The walking figure is an original capsule silhouette made of light. walk = smooth(0, 11.5, time) fs = mix(1.0, 0.56, walk) fx = 0.075 * sin(time * 0.34) + 0.10 * u * walk fy = mix(-0.19, 0.015, walk) lx = (u - fx) / fs ly = (v - fy) / fs fd = figure2(lx, ly, time * 2.15) fm = (1 - smooth(-0.014, 0.018, fd)) * (1 - 0.45 * walk) halo = exp(-max(fd, 0) * 10) * (0.45 + 0.12 * sin(time * 1.7)) cr = mix(cr, 0.95, fm) + halo * 0.14 cg = mix(cg, 0.98, fm) + halo * 0.22 cb = mix(cb, 1.00, fm) + halo * 0.32 # A distorted, fading reflection below the walker's feet. ry = 2 * fy - v rfd = figure2((u - fx + 0.004 * sin(v * 55 + time)) / fs, (ry - fy) / fs, time * 2.15) rfm = (1 - smooth(-0.01, 0.025, rfd)) * step(v, fy) * exp(-(fy - v) * 6.5) cr = mix(cr, 0.64, rfm * 0.48) cg = mix(cg, 0.84, rfm * 0.48) cb = mix(cb, 1.00, rfm * 0.48) ta = smooth(1.0, 2.4, time) * (1 - smooth(7.0, 9.0, time)) title = word(heading, 0.35, 0.135) * ta glow = word(heading, 0.35, 0.138) * ta cr = cr + title * 0.55 + glow * 0.18 cg = cg + title * 0.72 + glow * 0.22 cb = cb + title + glow * 0.34 creditA = smooth(0.4, 1.5, time) * (1 - smooth(9.5, 11.0, time)) subShadow = word(credit, -0.361, 0.046) * creditA cr = mix(cr, 0.025, subShadow * 0.72) cg = mix(cg, 0.040, subShadow * 0.72) cb = mix(cb, 0.090, subShadow * 0.72) sub = word(credit, -0.355, 0.046) * creditA cr = cr + sub * 0.72 cg = cg + sub * 0.78 cb = cb + sub * 0.94 rgb(cr, cg, cb) } # --------------------------------------------------------- II. the planet garden fn planets(px, py, pz) { d = len(len(px + 2.25, py - 0.10 - 0.10 * sin(time * 0.42)), pz + 0.25) - 0.82 d = min(d, len(len(px - 0.10, py - 0.62 - 0.12 * sin(time * 0.35 + 1)), pz - 0.15) - 0.68) d = min(d, len(len(px - 2.00, py - 0.30 - 0.12 * sin(time * 0.31 + 2)), pz + 0.65) - 0.54) d = min(d, len(len(px + 0.60, py - 1.48 - 0.09 * sin(time * 0.38)), pz + 1.10) - 0.36) d = min(d, len(len(px - 2.85, py - 1.35), pz - 0.80) - 0.30) d = min(d, len(len(px + 3.10, py - 1.15), pz - 1.25) - 0.26) rx = rot(px - 1.52, py - 0.70 - 0.12 * sin(time * 0.31 + 2), 0.52) ry = r1 ring = len(len(rx, pz + 0.65) - 0.91, ry) - 0.032 return min(d, ring) } fn garden(px, py, pz) { return min(py + 1.15, planets(px, py, pz)) } pixel spheres { ca = 0.20 + (time - 12) * 0.021 ox = 4.4 * sin(ca) oy = 2.35 + 0.22 * sin(time * 0.20) oz = 7.5 * cos(ca) fl = len(len(ox, oy - 0.20), oz) fx = -ox / fl fy = -(oy - 0.20) / fl fz = -oz / fl rl = len(fz, fx) + 0.0001 rx = fz / rl rz = -fx / rl ux = fy * rz uy = fz * rx - fx * rz uz = -fy * rx dx = fx * 1.65 + rx * u + ux * v dy = fy * 1.65 + uy * v dz = fz * 1.65 + rz * u + uz * v dl = len(len(dx, dy), dz) dx = dx / dl dy = dy / dl dz = dz / dl travel = 0.02 dist = 1 repeat i 44 { px = ox + dx * travel py = oy + dy * travel pz = oz + dz * travel dist = garden(px, py, pz) travel = travel + dist * 0.74 * step(0.006, dist) } hit = step(dist, 0.025) * step(travel, 28) px = ox + dx * travel py = oy + dy * travel pz = oz + dz * travel e = 0.012 nx = garden(px + e, py, pz) - garden(px - e, py, pz) ny = garden(px, py + e, pz) - garden(px, py - e, pz) nz = garden(px, py, pz + e) - garden(px, py, pz - e) nl = len(len(nx, ny), nz) + 0.0001 nx = nx / nl ny = ny / nl nz = nz / nl nd = nx * dx + ny * dy + nz * dz diff = max(nx * -0.42 + ny * 0.78 + nz * 0.46, 0) fres = (1 - max(-nd, 0)) ^ 3 band = 0.5 + 0.5 * sin(py * 10 + fbm(px * 1.8, pz * 1.8, 2) * 5) br = 0.48 + band * 0.32 bg = 0.62 + band * 0.25 bb = 0.82 + band * 0.18 if (px < -1.25 && py < 1.0) { br = 0.32 + band * 0.36; bg = 0.40 + band * 0.25; bb = 0.78 + band * 0.22 } if (px > 1.15 && py < 1.2) { br = 0.72 + band * 0.25; bg = 0.40 + band * 0.30; bb = 0.68 + band * 0.28 } if (py > 1.0) { br = 0.50 + band * 0.20; bg = 0.78 + band * 0.18; bb = 0.82 + band * 0.16 } # Reflection direction drives an analytic cloudy environment on curved balls. rdx = dx - 2 * nd * nx rdy = dy - 2 * nd * ny rdz = dz - 2 * nd * nz envc = fbm(rdx * 2.8 + 2, rdy * 2.8 + rdz, 3) envup = clamp(rdy * 0.5 + 0.5, 0, 1) spec = diff ^ 30 floorHit = hit * (1 - step(-1.08, py)) cr = 0 cg = 0 cb = 0 if (floorHit > 0.5) { # One genuine secondary SDF ray: the polished floor reflects the planets. rt = 0.035 rd = 1 repeat j 20 { qx = px + nx * 0.025 + rdx * rt qy = py + ny * 0.025 + rdy * rt qz = pz + nz * 0.025 + rdz * rt rd = planets(qx, qy, qz) rt = rt + rd * 0.78 * step(0.009, rd) } rhit = step(rd, 0.045) * step(rt, 18) rtex = fbm(qx * 1.5, qy * 1.5 + qz, 2) rr = mix(0.10 + envup * 0.22 + envc * 0.08, 0.34 + rtex * 0.48 + max(qy, 0) * 0.08, rhit) rg = mix(0.18 + envup * 0.28 + envc * 0.10, 0.42 + rtex * 0.38 + max(qy, 0) * 0.09, rhit) rb = mix(0.31 + envup * 0.36 + envc * 0.13, 0.68 + rtex * 0.28, rhit) grid = exp(-abs(fract(px * 0.48) - 0.5) * 48) + exp(-abs(fract(pz * 0.48) - 0.5) * 48) cr = rr * 0.69 + grid * 0.08 + diff * 0.025 cg = rg * 0.69 + grid * 0.11 + diff * 0.035 cb = rb * 0.72 + grid * 0.15 + diff * 0.05 } else { cr = (br * (0.24 + diff * 0.72) + envc * fres * 0.52 + spec) * hit cg = (bg * (0.24 + diff * 0.72) + envc * fres * 0.62 + spec) * hit cb = (bb * (0.24 + diff * 0.72) + envc * fres * 0.72 + spec) * hit } sky = 1 - hit star = exp(-len(dx - 0.34, dy - 0.27) * 85) + exp(-len(dx + 0.42, dy - 0.12) * 100) flare = exp(-abs(dx - 0.34) * 130) * exp(-abs(dy - 0.27) * 9) + exp(-abs(dy - 0.27) * 130) * exp(-abs(dx - 0.34) * 9) starDust = starfield(dx, dy, dz, ca) nebula = fbm(dx * 2.8 + ca * 0.30, dy * 3.6 - ca * 0.10, 4) horizon = exp(-abs(dy + 0.11) * 9.0) cr = cr + sky * (0.025 + nebula * 0.070 + horizon * 0.12 + starDust + star + flare * 0.35) cg = cg + sky * (0.045 + nebula * 0.105 + horizon * 0.17 + starDust * 0.94 + star + flare * 0.42) cb = cb + sky * (0.100 + nebula * 0.180 + horizon * 0.28 + starDust * 0.90 + star + flare * 0.60) fog = exp(-travel * 0.018 * hit) cr = mix(0.08, cr, fog) cg = mix(0.12, cg, fog) cb = mix(0.23, cb, fog) phrase = tracked(phraseA, 0.335, 0.052, 1.28) * smooth(16.0, 17.5, time) * (1 - smooth(22.0, 23.5, time)) cr = cr + phrase * 0.68 cg = cg + phrase * 0.66 cb = cb + phrase * 0.92 rgb(cr, cg, cb) blend = 1 - smooth(12, 13.6, time) cprev(x, y, blend * 0.94) } # -------------------------------------------------- III. green totem and pagoda fn totemObjects(px, py, pz) { a = 0.10 * sin(time * 0.22) gx = rot(px + 1.85, pz, a) gz = r1 roll = 0.045 * sin(time * 0.17) gx2 = rot(gx, py, roll) gy = r1 # One pierced emerald monolith, its foot exactly on the reflecting plane. green = max(box3(gx2, gy, gz, 0.80, 1.15, 0.25), 0.47 - len(gx2, gy - 0.04)) d = green # Four sloping planes and a base make a compact, rotating pyramid. pxr = rot(px - 0.10, pz, -time * 0.23) pzr = r1 yy = py + 1.15 pyramid = max((abs(pxr) * 1.8 + yy - 2.05) * 0.485, (abs(pzr) * 1.8 + yy - 2.05) * 0.485) pyramid = max(pyramid, -yy) d = min(d, pyramid) # A small pagoda assembles itself, one descending roof at a time. cx = px - 2.35 stem = max(len(cx, pz) - 0.16, abs(py - 0.12) - 1.30) d = min(d, stem) b0 = smooth(30.0, 33.0, time) b1 = smooth(32.0, 35.0, time) b2 = smooth(34.0, 37.0, time) b3 = smooth(36.0, 39.0, time) roof = box3(cx, py + 0.65 - (1 - b0) * 2.4, pz, 0.93, 0.09, 0.55) roof = min(roof, box3(cx, py - 0.02 - (1 - b1) * 2.4, pz, 0.75, 0.085, 0.46)) roof = min(roof, box3(cx, py - 0.59 - (1 - b2) * 2.4, pz, 0.57, 0.075, 0.37)) roof = min(roof, box3(cx, py - 1.12 - (1 - b3) * 2.4, pz, 0.38, 0.065, 0.28)) d = min(d, roof) oa = time * 0.55 # Two paths thread the opening; the wider middle path travels around it. d = min(d, len(len(px + 1.85 - cos(oa) * 0.24, py - 0.04 - sin(oa) * 0.18), pz - sin(oa) * 1.25) - 0.14) d = min(d, len(len(px + 1.85 - cos(oa + 2.1) * 1.10, py - 0.04 - sin((oa + 2.1) * 0.7) * 0.32), pz - sin(oa + 2.1) * 1.10) - 0.13) d = min(d, len(len(px + 1.85 - cos(oa + 4.2) * 0.30, py - 0.04 - sin(oa + 4.2) * 0.20), pz - sin(oa + 4.2) * 1.30) - 0.11) return d } fn totemScene(px, py, pz) { return min(py + 1.15, totemObjects(px, py, pz)) } pixel totem { ca = -0.10 + 0.08 * sin((time - 28) * 0.16) ox = 7.9 * sin(ca) oy = 2.45 + 0.12 * sin(time * 0.22) oz = 8.4 * cos(ca) fl = len(len(ox, oy - 0.25), oz) fx = -ox / fl fy = -(oy - 0.25) / fl fz = -oz / fl rl = len(fz, fx) + 0.0001 rx = fz / rl rz = -fx / rl ux = fy * rz uy = fz * rx - fx * rz uz = -fy * rx dx = fx * 1.72 + rx * u + ux * v dy = fy * 1.72 + uy * v dz = fz * 1.72 + rz * u + uz * v dl = len(len(dx, dy), dz) dx = dx / dl dy = dy / dl dz = dz / dl travel = 0.02 dist = 1 repeat i 42 { px = ox + dx * travel py = oy + dy * travel pz = oz + dz * travel dist = totemScene(px, py, pz) travel = travel + dist * 0.66 * step(0.006, dist) } hit = step(dist, 0.027) * step(travel, 28) px = ox + dx * travel py = oy + dy * travel pz = oz + dz * travel e = 0.014 nx = totemScene(px + e, py, pz) - totemScene(px - e, py, pz) ny = totemScene(px, py + e, pz) - totemScene(px, py - e, pz) nz = totemScene(px, py, pz + e) - totemScene(px, py, pz - e) nl = len(len(nx, ny), nz) + 0.0001 nx = nx / nl ny = ny / nl nz = nz / nl nd = nx * dx + ny * dy + nz * dz diff = max(nx * -0.35 + ny * 0.82 + nz * 0.45, 0) rim = (1 - max(-nd, 0)) ^ 3 br = 0.035 bg = 0.52 bb = 0.24 if (px > -0.95 && px < 1.20) { br = 0.62; bg = 0.48; bb = 0.83 } if (px > 1.20) { br = 0.77; bg = 0.43 + 0.20 * sin(py * 8); bb = 0.60 } floorHit = hit * (1 - step(-1.08, py)) rdx = dx - 2 * nd * nx rdy = dy - 2 * nd * ny rdz = dz - 2 * nd * nz cr = 0 cg = 0 cb = 0 if (floorHit > 0.5) { rt = 0.035 rd = 1 repeat j 16 { qx = px + nx * 0.025 + rdx * rt qy = py + ny * 0.025 + rdy * rt qz = pz + nz * 0.025 + rdz * rt rd = totemObjects(qx, qy, qz) rt = rt + rd * 0.68 * step(0.010, rd) } rhit = step(rd, 0.05) * step(rt, 16) greenRef = 1 - step(-0.7, qx) rr = mix(0.12 + 0.16 * max(rdy, 0), mix(0.62, 0.04, greenRef), rhit) rg = mix(0.17 + 0.20 * max(rdy, 0), mix(0.40, 0.58, greenRef), rhit) rb = mix(0.28 + 0.29 * max(rdy, 0), mix(0.67, 0.25, greenRef), rhit) seam = exp(-abs(fract(pz * 0.45) - 0.5) * 42) cr = rr * 0.60 + seam * 0.055 cg = rg * 0.62 + seam * 0.075 cb = rb * 0.67 + seam * 0.11 } else { cr = (br * (0.22 + diff * 0.78) + rim * 0.17 + (diff ^ 28) * 0.65) * hit cg = (bg * (0.22 + diff * 0.78) + rim * 0.25 + (diff ^ 28) * 0.65) * hit cb = (bb * (0.22 + diff * 0.78) + rim * 0.31 + (diff ^ 28) * 0.65) * hit } greenMask = (1 - step(-0.95, px)) * hit * (1 - floorHit) holeR = len(px + 1.85, py - 0.04) innerRim = exp(-abs(holeR - 0.47) * 20) * greenMask cr = cr + innerRim * 0.10 + greenMask * rim * 0.035 cg = cg + innerRim * 0.52 + greenMask * rim * 0.16 cb = cb + innerRim * 0.28 + greenMask * rim * 0.085 sky = 1 - hit mist = fbm(dx * 2.3 + time * 0.01, dy * 3.0, 3) starDust = starfield(dx, dy, dz, ca) * 0.48 cr = cr + sky * (0.040 + mist * 0.065 + starDust * 0.75) cg = cg + sky * (0.065 + mist * 0.10 + starDust * 0.85) cb = cb + sky * (0.12 + mist * 0.16 + starDust) phrase = tracked(phraseB, 0.355, 0.046, 1.20) * smooth(31.5, 33.0, time) * (1 - smooth(38.0, 39.5, time)) cr = cr + phrase * 0.66 cg = cg + phrase * 0.76 cb = cb + phrase * 0.83 rgb(cr, cg, cb) blend = 1 - smooth(28, 29.6, time) cprev(x, y, blend * 0.94) } # -------------------------------------------------------- IV. the magenta vessel fn shellD(px, py, pz) { shell = abs(len(len(px, py - 0.25), pz) - 3.45) - 0.095 shell = max(shell, pz) return max(shell, -py - 1.15) } fn vesselObjects(px, py, pz) { d = shellD(px, py, pz) d = min(d, len(len(px + 1.25, py - 0.25 - 0.10 * sin(time * 0.4)), pz + 0.35) - 0.64) d = min(d, len(len(px - 0.85, py - 0.75 - 0.11 * sin(time * 0.33)), pz + 0.75) - 0.48) d = min(d, len(len(px - 0.10, py + 0.55 - 0.09 * sin(time * 0.45)), pz + 0.15) - 0.34) d = min(d, len(len(px - 1.65, py + 0.45), pz + 1.05) - 0.24) d = min(d, len(len(px + 1.90, py + 0.60), pz + 1.30) - 0.27) d = min(d, len(len(px + 0.15, py + 0.05 - 0.06 * sin(time * 0.51)), pz - 0.70) - 0.20) return d } fn vesselScene(px, py, pz) { return min(py + 1.85, vesselObjects(px, py, pz)) } pixel vessel { enter = smooth(42, 50, time) ox = 0.35 * sin(time * 0.17) oy = 1.20 + 0.15 * sin(time * 0.21) oz = mix(10.2, 3.65, enter) fl = len(len(ox, oy - 0.10), oz) fx = -ox / fl fy = -(oy - 0.10) / fl fz = -oz / fl rl = len(fz, fx) + 0.0001 rx = fz / rl rz = -fx / rl ux = fy * rz uy = fz * rx - fx * rz uz = -fy * rx dx = fx * 1.55 + rx * u + ux * v dy = fy * 1.55 + uy * v dz = fz * 1.55 + rz * u + uz * v dl = len(len(dx, dy), dz) dx = dx / dl dy = dy / dl dz = dz / dl travel = 0.02 dist = 1 repeat i 44 { px = ox + dx * travel py = oy + dy * travel pz = oz + dz * travel dist = vesselScene(px, py, pz) travel = travel + dist * 0.72 * step(0.006, dist) } hit = step(dist, 0.026) * step(travel, 28) px = ox + dx * travel py = oy + dy * travel pz = oz + dz * travel e = 0.014 nx = vesselScene(px + e, py, pz) - vesselScene(px - e, py, pz) ny = vesselScene(px, py + e, pz) - vesselScene(px, py - e, pz) nz = vesselScene(px, py, pz + e) - vesselScene(px, py, pz - e) nl = len(len(nx, ny), nz) + 0.0001 nx = nx / nl ny = ny / nl nz = nz / nl nd = nx * dx + ny * dy + nz * dz diff = max(nx * -0.30 + ny * 0.76 + nz * 0.58, 0) rim = (1 - max(-nd, 0)) ^ 2 sd = shellD(px, py, pz) shellHit = hit * (1 - step(0.065, sd)) longitude = atan2(py - 0.25, px) filigree = (0.5 + 0.5 * sin(longitude * 18 + pz * 2.4)) ^ 18 shellTex = fbm(px * 0.75 + pz * 0.20, py * 0.90, 3) cr = (0.46 + shellTex * 0.20 + rim * 0.52 + filigree * 0.12) * shellHit cg = (0.065 + shellTex * 0.07 + rim * 0.13 + filigree * 0.045) * shellHit cb = (0.46 + shellTex * 0.20 + rim * 0.48 + filigree * 0.15) * shellHit planetHit = hit * (1 - shellHit) * step(-1.70, py) bands = 0.5 + 0.5 * sin(py * 14 + fbm(px * 2, pz * 2, 2) * 4) tone = 0.5 + 0.5 * sin(px * 1.7 + py * 2.3) planetRim = (1 - max(-nd, 0)) ^ 3 cr = cr + planetHit * ((0.32 + bands * 0.42 + tone * 0.18) * (0.40 + diff * 0.75) + (diff ^ 26) + planetRim * 0.18) cg = cg + planetHit * ((0.40 + bands * 0.32 + (1 - tone) * 0.18) * (0.40 + diff * 0.75) + (diff ^ 26) + planetRim * 0.20) cb = cb + planetHit * ((0.68 + bands * 0.26 + tone * 0.10) * (0.40 + diff * 0.75) + (diff ^ 26) + planetRim * 0.24) floorHit = hit * (1 - step(-1.78, py)) cr = mix(cr, 0.17 + 0.18 * max(-dy, 0), floorHit) cg = mix(cg, 0.055 + 0.055 * max(-dy, 0), floorHit) cb = mix(cb, 0.21 + 0.24 * max(-dy, 0), floorHit) sky = 1 - hit neb = fbm(dx * 3.2 + time * 0.015, dy * 3.2 - pz * 0.02, 4) aura = exp(-len(dx, dy) * 2.0) starDust = starfield(dx, dy, dz, enter) * 0.28 cr = cr + sky * (0.12 + neb * 0.24 + aura * 0.18 + starDust * 0.85) cg = cg + sky * (0.035 + neb * 0.055 + aura * 0.035 + starDust * 0.80) cb = cb + sky * (0.17 + neb * 0.28 + aura * 0.24 + starDust) rgb(cr, cg, cb) blend = 1 - smooth(42, 43.8, time) cprev(x, y, blend * 0.95) } # --------------------------------------------------------- V. planets in liquid fn floaters(px, py, pz) { d = len(len(px + 1.65, py - 0.15 - 0.11 * sin(time * 0.38)), pz + 0.15) - 0.72 d = min(d, len(len(px - 0.55, py - 0.52 - 0.09 * sin(time * 0.44)), pz - 0.10) - 0.48) d = min(d, len(len(px - 1.55, py + 0.02 - 0.08 * sin(time * 0.41)), pz + 0.75) - 0.34) d = min(d, len(len(px + 0.10, py - 1.10 - 0.06 * sin(time * 0.50)), pz - 0.75) - 0.22) d = min(d, len(len(px - 2.55, py - 0.82), pz - 0.30) - 0.20) d = min(d, len(len(px + 2.60, py - 0.62), pz - 0.85) - 0.25) rx = rot(px - 0.55, py - 0.52 - 0.09 * sin(time * 0.44), -0.42) ry = r1 ring = len(len(rx, pz - 0.10) - 0.77, ry) - 0.025 return min(d, ring) } fn liquidScene(px, py, pz) { wave = 0.040 * sin(px * 3.1 + time * 0.72) * sin(pz * 2.7 - time * 0.54) wave = wave + 0.007 * sin((px + pz) * 7.2 - time * 0.90) water = (py + 1.12 + wave) * 0.62 return min(water, floaters(px, py, pz)) } pixel liquid { ox = 0.38 * sin((time - 50) * 0.13) oy = 0.52 + 0.10 * sin(time * 0.19) oz = 6.5 - 0.35 * smooth(50, 60, time) fl = len(len(ox, oy - 0.05), oz) fx = -ox / fl fy = -(oy - 0.05) / fl fz = -oz / fl rl = len(fz, fx) + 0.0001 rx = fz / rl rz = -fx / rl ux = fy * rz uy = fz * rx - fx * rz uz = -fy * rx dx = fx * 1.62 + rx * u + ux * v dy = fy * 1.62 + uy * v dz = fz * 1.62 + rz * u + uz * v dl = len(len(dx, dy), dz) dx = dx / dl dy = dy / dl dz = dz / dl travel = 0.02 dist = 1 repeat i 46 { px = ox + dx * travel py = oy + dy * travel pz = oz + dz * travel dist = liquidScene(px, py, pz) travel = travel + dist * 0.67 * step(0.005, dist) } hit = step(dist, 0.024) * step(travel, 25) px = ox + dx * travel py = oy + dy * travel pz = oz + dz * travel e = 0.012 nx = liquidScene(px + e, py, pz) - liquidScene(px - e, py, pz) ny = liquidScene(px, py + e, pz) - liquidScene(px, py - e, pz) nz = liquidScene(px, py, pz + e) - liquidScene(px, py, pz - e) nl = len(len(nx, ny), nz) + 0.0001 nx = nx / nl ny = ny / nl nz = nz / nl nd = nx * dx + ny * dy + nz * dz diff = max(nx * -0.38 + ny * 0.80 + nz * 0.48, 0) fres = (1 - max(-nd, 0)) ^ 3 rdx = dx - 2 * nd * nx rdy = dy - 2 * nd * ny rdz = dz - 2 * nd * nz waterHit = hit * (1 - step(-1.00, py)) cr = 0 cg = 0 cb = 0 if (waterHit > 0.5) { # The liquid is another true one-bounce reflector, with normal-driven ripples. rt = 0.035 rd = 1 repeat j 28 { qx = px + nx * 0.025 + rdx * rt qy = py + ny * 0.025 + rdy * rt qz = pz + nz * 0.025 + rdz * rt rd = floaters(qx, qy, qz) rt = rt + rd * 0.76 * step(0.008, rd) } rhit = step(rd, 0.042) * step(rt, 22) rtex = fbm(qx * 1.8 + qz, qy * 2.0, 3) mirrorBand = (0.5 + 0.5 * sin(rdy * 13 + rdx * 3 + sin(rdz * 2))) ^ 6 mirrorCloud = fbm(rdx * 3.5 + time * 0.015, rdy * 6.5, 3) rr = mix(0.20 + 0.24 * max(rdy, 0) + mirrorCloud * 0.24 + mirrorBand * 0.30, 0.40 + rtex * 0.50, rhit) rg = mix(0.10 + 0.20 * max(rdy, 0) + mirrorCloud * 0.18 + mirrorBand * 0.26, 0.35 + rtex * 0.43, rhit) rb = mix(0.32 + 0.34 * max(rdy, 0) + mirrorCloud * 0.30 + mirrorBand * 0.36, 0.66 + rtex * 0.32, rhit) caustic = (0.5 + 0.5 * sin(px * 8 + sin(pz * 6 - time) * 2)) ^ 10 deep = fbm(px * 1.5 + time * 0.025, pz * 1.5, 3) cr = mix(0.035 + deep * 0.05 + caustic * 0.035, rr, 0.74 + fres * 0.24) cg = mix(0.050 + deep * 0.07 + caustic * 0.045, rg, 0.74 + fres * 0.24) cb = mix(0.13 + deep * 0.14 + caustic * 0.10, rb, 0.74 + fres * 0.24) } else { bands = 0.5 + 0.5 * sin(py * 12 + fbm(px * 2.1, pz * 2.1, 3) * 5) env = fbm(rdx * 2.5, rdy * 2.5 + rdz, 3) cr = ((0.38 + bands * 0.48) * (0.25 + diff * 0.76) + env * fres * 0.46 + diff ^ 30) * hit cg = ((0.32 + bands * 0.38) * (0.25 + diff * 0.76) + env * fres * 0.35 + diff ^ 30) * hit cb = ((0.66 + bands * 0.30) * (0.25 + diff * 0.76) + env * fres * 0.58 + diff ^ 30) * hit } sky = 1 - hit neb = fbm(dx * 2.4 + time * 0.012, dy * 3.0 - time * 0.009, 4) curtain = 0.5 + 0.5 * sin(atan2(dy, dx) * 7 + neb * 4 + time * 0.08) starDust = starfield(dx, dy, dz, time * 0.01) * 0.18 cr = cr + sky * (0.16 + neb * 0.30 + curtain * 0.10 + starDust * 0.85) cg = cg + sky * (0.055 + neb * 0.085 + curtain * 0.035 + starDust * 0.80) cb = cb + sky * (0.25 + neb * 0.35 + curtain * 0.14 + starDust) horizon = exp(-abs(dy + 0.055) * 18) cr = cr + horizon * (sky * 0.30 + waterHit * 0.12) cg = cg + horizon * (sky * 0.22 + waterHit * 0.10) cb = cb + horizon * (sky * 0.38 + waterHit * 0.20) phrase = tracked(phraseC, 0.340, 0.048, 1.22) * smooth(51.0, 52.0, time) * (1 - smooth(55.3, 56.2, time)) cr = cr + phrase * 0.72 cg = cg + phrase * 0.68 cb = cb + phrase * 0.94 # The final credit sits in clear sky, not over the high-frequency water. ta = smooth(56.3, 57.8, time) title = word(heading, 0.345, 0.118) * ta cr = cr + title * 0.62 cg = cg + title * 0.72 cb = cb + title * 0.94 subShadow = word(credit, 0.209, 0.044) * ta cr = mix(cr, 0.025, subShadow * 0.72) cg = mix(cg, 0.020, subShadow * 0.72) cb = mix(cb, 0.065, subShadow * 0.72) sub = word(credit, 0.215, 0.044) * ta cr = cr + sub * 0.68 cg = cg + sub * 0.70 cb = cb + sub * 0.92 rgb(cr, cg, cb) blend = 1 - smooth(50, 52.0, time) cprev(x, y, blend * 0.95) } # A restrained common lens: bright-neighbour bloom, violet chromatic fringe, # ordered grain and a soft vignette. No scanlines; the dream stays weightless. post { pr = cget(0) pg = cget(1) pb = cget(2) a = tap(-4, 0); ar = a; ag = r1; ab = r2 a = tap(4, 0); ar = ar + a; ag = ag + r1; ab = ab + r2 a = tap(0, -4); ar = ar + a; ag = ag + r1; ab = ab + r2 a = tap(0, 4); ar = ar + a; ag = ag + r1; ab = ab + r2 a = tap(-3, -3); ar = ar + a; ag = ag + r1; ab = ab + r2 a = tap(3, 3); ar = ar + a; ag = ag + r1; ab = ab + r2 a = tap(-3, 3); ar = ar + a; ag = ag + r1; ab = ab + r2 a = tap(3, -3); ar = ar + a; ag = ag + r1; ab = ab + r2 br = max(ar * 0.125 - 0.38, 0) * 0.24 bg = max(ag * 0.125 - 0.38, 0) * 0.22 bb = max(ab * 0.125 - 0.32, 0) * 0.27 fringe = tap(1, 0) - pr grain = (hash(floor(x * w) + floor(y * h) * 1777 + frame * 0.17) - 0.5) * 0.009 vig = 1 - 0.17 * len(u * 0.72, v * 0.90) ^ 2 rgb((pr + br + fringe * 0.035 + grain) * vig, (pg + bg + grain) * vig, (pb + bb - fringe * 0.018 + grain) * vig) }