NIGHTTRAIN
nighttrain.dmt · 120 BPM · 30 s · 960×600
model-madesame brief
notes
the darkest reading: a hooded silhouette under a dying fluorescent, a split-flap board settling on DELAYED, a signal clicking red to green at 21 s, then a headlight and sub rumble
| file | nighttrain.dmt |
|---|---|
| duration | 0:30 |
| video | 960×600 · 30 fps · h264 + audio · 26 MB |
| song | 120 BPM · speed 6 · rpb 4 · 8 channels |
| loop | 0 |
| render | scale 2 · dither on · master 0.62 |
| uniforms | flick kickE hlE hl2 zh sigG rainA sway fogA |
| model | Kimi K3 |
| collection | Same brief, six models |
| tags | model-madesame brief |
| source | 694 lines · 20 KB · download |
anatomy
15VM programs
9patterns
0palettes
13timeline events
2text / sample / texture
694source lines
9inst
2chan
1master
1frame
1pixel
1post
2fn
line composition
pixel 48%pattern 25%inst 11%fn 5%post 3%frame 2%timeline 2%chan 1%master 1%text 0%title 0%song 0%order 0%pan 0%uniform 0%
play order
012323412345678
order list · 15 entries
timeline
| at | event | value | source | |
|---|---|---|---|---|
| 0:00 | rain | 0.55 | L27 | |
| 0:00 | sig | 0 | L27 | |
| 0:00 | hl | 0 | L27 | |
| 0:06 | rain | 0.90 | L28 | |
| 0:12 | rain | 0.50 | L29 | |
| 0:18 | rain | 0.85 | L30 | |
| 0:20 | sig | 0 | L31 | |
| 0:21 | sig | 1 | L32 | |
| 0:22 | hl | 0 | L33 | |
| 0:23 | hl | 0.06 | L34 | |
| 0:24 | rain | 0.60 | L35 | |
| 0:28 | rain | 0.45 | L36 | |
| 0:29 | hl | 1 | L37 |
Event times are derived from the order list, pattern lengths, BPM and RPB.
resources
| kind | name | info | value |
|---|---|---|---|
| text | TITLE | 10 | NIGHTTRAIN |
| text | SUB | 7 | DELAYED |
source
1# @model Kimi K3
2# @collection Same brief, six models
3# @description the darkest reading: a hooded silhouette under a dying fluorescent, a split-flap board settling on DELAYED, a signal clicking red to green at 21 s, then a headlight and sub rumble
4# @tags brief
5# nighttrain.dmt - a nearly empty platform at 4 a.m. One person waits.
6# The train is late. Fluorescent tubes buzz (one of them dying, and you can
7# hear which one), a vending machine hums cold light onto wet concrete, rain
8# runs down the shelter glass between us and the scene. The split-flap board
9# settles on NIGHTTRAIN / DELAYED. At the very end a light grows down the
10# track - maybe the train, maybe not.
11#
12# One continuous fixed wide shot, one-point perspective down the platform.
13# Audio: 120 BPM downtempo in D minor - mains hum + tube buzz (flicker formula
14# shared sample-for-sample with the video), rain, soft kick, sub bass, chord
15# pad, FM bells, distant diminished horn, and a rising rumble driven by the
16# same clock as the headlight glow. scale=2 keeps it filmic and fast.
18title NIGHTTRAIN
19song bpm=120 speed=6 rpb=4 channels=8 loop=0 volume=0.62 scale=2 dither=1
20order 0 1 2 3 2 3 4 1 2 3 4 5 6 7 8
21pan 0.50 0.55 0.50 0.45 0.50 0.62 0.50 0.55
23text TITLE "NIGHTTRAIN"
24text SUB "DELAYED"
26timeline {
27 0:00 rain=0.55 sig=0 hl=0
28 3:00 rain=0.90
29 6:00 rain=0.50
30 9:00 rain=0.85
31 10:00 sig=0
32 10:10 sig=1
33 11:00 hl=0
34 11:08 hl=0.06
35 12:00 rain=0.60
36 14:00 rain=0.45
37 14:08 hl=1
38}
40# ------------------------------------------------------------------ audio
41# 1 kick 2 perc(click/plink) 3 bass 4 pad 5 bell 6 hum 7 rain 8 rumble 9 horn
43inst kick {
44 f = 42 + 190 * exp(-t * 20)
45 $p = $p + f / sr
46 body = sin($p * tau) * exp(-t * 4.2)
47 air = lp(noise(), 300) * exp(-t * 30) * 0.3
48 out(dist(body * 1.9 + air, 1.35) * 0.60)
49}
51inst perc {
52 # vol >= 0x14: split-flap board click. quieter: a droplet plinking off the roof.
53 isC = step(0.30, vel)
54 cn = hp(noise(), 3600) * exp(-t * 95) + sin(tau * 2100 * t) * exp(-t * 140) * 0.6
55 pe = exp(-t * 16)
56 pm = sin(ph * tau * 2.71) * 1.8 * exp(-t * 9)
57 pl = sin(ph * tau + pm) * pe
58 out(mix(pl * 0.9, cn * 1.7, isC) * 0.16)
59}
61inst bass {
62 e = env(0.015, 0.45, 0.55, 0.30)
63 s = sin(ph * tau) * 0.9
64 s = s + svf(bsaw(ph, freq), 150 + 260 * e, 0.35) * 0.45
65 out(dist(s, 1.2) * e * 0.50)
66}
68inst pad nna=continue {
69 # one finger, whole minor triad
70 e = env(1.1, 1.6, 0.80, 2.4)
71 s = bsaw(ph, freq) * 0.30 + bsaw(ph + 0.0013 * t, freq) * 0.26
72 s = s + bsaw(ph * 1.18921, freq * 1.18921) * 0.22
73 s = s + bsaw(ph * 1.49831, freq * 1.49831) * 0.22
74 s = s + sin(ph * tau * 2) * 0.10
75 s = svf(s, 430 + 480 * e + 170 * sin(t * 0.29), 0.30)
76 out(s * e * 0.15)
77}
79inst bell nna=continue {
80 e = exp(-t * 2.4)
81 mi = 3.2 * exp(-t * 2.9)
82 m = sin(ph * tau * 3.007) * mi
83 s = sin(ph * tau + m) + sin(ph * tau * 2.003 + m * 0.4) * 0.30
84 out(s * e * 0.20)
85}
87inst hum {
88 # mains hum from the vending machine + the harsh buzz of the dying tube.
89 # the flicker formula is identical to the one in `frame`, so the tube you
90 # see stuttering is the one you hear.
91 e = env(1.2, 1.0, 1.0, 2.0)
92 fl = 0.55 + 0.45 * step(0.28, hash(floor(t * 17) * 0.317))
93 fl = fl * step(0.10, hash(floor(t * 17) * 1.71 + 7.3))
94 fl = fl * (0.9 + 0.1 * sin(t * 51))
95 s = osc(60 * t) * 0.5 + osc(120 * t) * 0.20 + osc(180 * t) * 0.07
96 bz = hp(noise(), 2400) * 0.5
97 out((s * (0.55 + 0.45 * fl) * 0.5 + bz * fl * 0.35) * e * 0.085)
98}
100inst rain {
101 e = env(1.5, 1.0, 1.0, 2.5)
102 n = svf(noise(), 2600 + 900 * sin(t * 0.23), 0.12)
103 body = r2 * 1.2 + n * 0.3
104 low = lp(noise(), 110) * 0.5
105 out((body * (0.75 + 0.25 * sin(t * 0.13 + 1)) * 0.5 + low * 0.35) * e * 0.16)
106}
108inst rumble {
109 amp = min(t / 6.5, 1)
110 amp = amp * amp
111 n = lp(noise(), 45 + 300 * amp)
112 sub = osc(30 * t) * 0.8 + osc(45 * t) * 0.3
113 out(dist((n * 0.9 + sub * 0.7) * (0.3 + amp), 1.25) * amp * 0.55)
114}
116inst horn {
117 # distant two-note-plus-tritone horn, far away and low-passed
118 e = env(0.8, 0.5, 0.75, 1.6)
119 tr = 0.88 + 0.12 * sin(t * 5.3)
120 s = osc(ph) + osc(ph * 1.18921) * 0.8 + osc(ph * 1.41421) * 0.7
121 s = lp(s * 0.5, 750)
122 out(s * e * tr * 0.20)
123}
125chan 3 {
126 w = verb(x, 0.78, 0.45)
127 out(x * 0.7 + w * 0.55)
128}
129chan 4 {
130 d = dly(x, 0.375, 0.40)
131 w = verb(x * 0.6 + d * 0.3, 0.6, 0.5)
132 out(x * 0.8 + d * 0.30 + w * 0.25)
133}
134master {
135 dl = dly(l, 0.29, 0.28)
136 dr = dly(r, 0.43, 0.28)
137 vl = verb(l + dr * 0.15, 0.62, 0.5)
138 vr = verb(r + dl * 0.15, 0.62, 0.5)
139 out(dist(l * 0.85 + dr * 0.10 + vl * 0.13, 1.12), dist(r * 0.85 + dl * 0.10 + vr * 0.13, 1.12))
140}
142# ------------------------------------------------------------------ score
143# channels: 0 kick | 1 perc | 2 bass | 3 pad | 4 bell/horn | 5 hum | 6 rain | 7 rumble
144# one pattern = one bar = 2 s. arc: Dm Dm Bb F / Bb F Gm lull / repeat / Dm Bb F Dm finale.
146pattern 0 rows=16 {
147 . | . | . | D-3 4 34 | . | C-2 6 1C | C-2 7 24
148 .
149 .
150 .
151 .
152 .
153 .
154 .
155 .
156 . | E-6 2 0C
157 .
158 .
159 .
160 .
161 .
162 .
163}
165pattern 1 rows=16 {
166 C-2 1 2E | . | D-2 3 38 | D-3 4 30
167 .
168 . | C-5 2 16
169 . | C-6 2 12
170 . | C-5 2 14 | . | F-5 5 2A
171 . | C-6 2 18
172 .
173 . | C-5 2 12
174 . | D-6 2 16 | A-1 3 2E
175 . | C-6 2 12
176 . | . | . | . | E-5 5 26
177 . | C-5 2 14
178 .
179 .
180 . | . | . | . | D-5 5 22
181 .
182}
184pattern 2 rows=16 {
185 C-2 1 2E | . | A#1 3 38 | A#2 4 30
186 .
187 .
188 .
189 . | . | . | . | F-5 5 24
190 . | A-5 2 10
191 .
192 .
193 C-2 1 28 | . | F-1 3 2E
194 .
195 . | . | . | . | D-5 5 22
196 .
197 . | D-6 2 0C
198 .
199 .
200 .
201}
203pattern 3 rows=16 {
204 C-2 1 2E | . | F-1 3 38 | F-2 4 30
205 .
206 .
207 . | G-5 2 0E
208 .
209 .
210 . | . | . | . | C-5 5 24
211 .
212 C-2 1 28 | . | C-2 3 2E
213 .
214 .
215 .
216 . | . | . | . | A-4 5 22
217 . | E-6 2 0A
218 .
219 .
220}
222pattern 4 rows=16 {
223 . | . | G-1 3 34 | G-2 4 2E
224 .
225 .
226 .
227 . | . | . | . | G-4 5 20
228 .
229 . | C-6 2 10
230 .
231 .
232 .
233 . | C-5 2 1E
234 . | C-6 2 16
235 .
236 .
237 . | . | . | . | A-4 5 1E
238 .
239}
241pattern 5 rows=16 {
242 C-2 1 30 | . | D-2 3 38 | D-3 4 32 | . | . | . | C-1 8 30
243 .
244 . | . | . | . | F-5 5 28
245 .
246 .
247 .
248 .
249 . | A-5 2 0E
250 C-2 1 2C | . | A-1 3 30
251 .
252 . | . | . | . | A-5 5 26
253 .
254 .
255 .
256 .
257 .
258}
260pattern 6 rows=16 {
261 C-2 1 30 | . | A#1 3 38 | A#2 4 32 | A-2 9 2C
262 .
263 .
264 .
265 .
266 .
267 .
268 .
269 C-2 1 2C | . | F-1 3 2E
270 .
271 .
272 .
273 . | . | . | . | D-5 5 20
274 .
275 . | . | . | . | F-5 5 1C
276 .
277}
279pattern 7 rows=16 {
280 C-2 1 34 | . | F-1 3 3A | F-2 4 34
281 .
282 .
283 .
284 C-2 1 2E | . | . | . | A-4 5 24
285 .
286 . | D-6 2 10
287 .
288 C-2 1 30 | . | C-2 3 30 | . | C-5 5 26
289 .
290 .
291 .
292 C-2 1 2E | . | . | . | D-5 5 24
293 .
294 . | . | C-2 3 28
295 .
296}
298pattern 8 rows=16 {
299 C-2 1 38 | . | D-2 3 3C | D-3 4 38 | D-3 9 30
300 .
301 .
302 .
303 C-2 1 30
304 .
305 .
306 .
307 C-2 1 34 | . | A-1 3 30 | . | A-5 5 26
308 .
309 .
310 .
311 C-2 1 30 | . | . | . | D-6 5 24
312 . | E-6 2 0C
313 .
314 .
315}
317# ------------------------------------------------------------------ helpers
318fn figd(pxx, pyy) {
319 # the waiting figure: hooded head, long coat, two legs. screen-space SDF.
320 # stands at world (0.30, 9.5), silhouetted against a tube's reflection.
321 cx = 0.04105 + sway * 0.13684
322 dx = pxx - cx
323 dh = len(dx, pyy - 0.0227) - 0.0164
324 lam = clamp((pyy + 0.0046) / (-0.1510 + 0.0046), 0, 1)
325 halfw = mix(0.0260, 0.0356, lam)
326 db = max(abs(dx) - halfw, max(-0.1510 - pyy, pyy + 0.0046)) - 0.007
327 dl = max(abs(abs(dx) - 0.0123) - 0.0062, max(-0.1989 - pyy, pyy + 0.1510))
328 return min(dh, min(db, dl))
329}
331fn boardline(pxx, pyy, s, n, y0, y1, t0, mk) {
332 # one split-flap text line on the departure board; letters scramble, then
333 # settle one by one (the clicks live in pattern 1 at the same times).
334 bu = (pxx - (-0.0520)) / 0.29714
335 cx = (bu - 0.05) / 0.9 * n
336 i = floor(cx)
337 gx = fract(cx)
338 gy = (y1 - pyy) / (y1 - y0)
339 settle = t0 + i * 0.12
340 done = step(settle, t)
341 scr = 65 + floor(26 * hash(i * 7.31 + floor(t * 13) * 0.913 + n))
342 code = mix(scr, str(s, i), done)
343 bri = mix(0.25 + 0.55 * hash(i * 3.17 + floor(t * 13) * 1.71), 1.0, done)
344 m = glyph(code, gx, gy) * step(0, i) * step(i, n - 1) * step(0, gy) * step(gy, 1) * mk * bri
345 fl = 0.82 + 0.18 * flick
346 ti = step(abs(n - 10), 0.5)
347 cadd(m * 1.05 * fl, m * mix(0.30, 0.60, ti) * fl, m * 0.09 * fl)
348}
350# ------------------------------------------------------------------ visuals
351uniform flick kickE hlE hl2 zh sigG rainA sway fogA
353frame {
354 # the dying fluorescent tube: same formula as the hum instrument's gate
355 fl = 0.55 + 0.45 * step(0.28, hash(floor(t * 17) * 0.317))
356 fl = fl * step(0.10, hash(floor(t * 17) * 1.71 + 7.3))
357 flick = fl * (0.9 + 0.1 * sin(t * 51))
358 kickE = exp(-trig(0) * 6)
359 hlE = evtl(hl)
360 hl2 = hlE * hlE
361 zh = mix(170, 30, hlE ^ 1.3)
362 sigG = evtl(sig)
363 rainA = evtl(rain)
364 sway = 0.0016 * sin(t * 1.9) + 0.0022 * sin(t * 0.23)
365 fogA = 0.7 + 0.3 * sin(t * 0.11)
366}
368pixel {
369 # camera micro-sway, then rain running down the shelter glass: two stretched
370 # fbm fields scrolling downward refract everything behind them
371 su = u + 0.0016 * sin(t * 0.43) + 0.0009 * sin(t * 0.97 + 2.0)
372 sv = v + 0.0012 * sin(t * 0.51 + 1.0)
373 st1 = fbm(su * 22 + 7.3, sv * 2.4 - t * 0.55, 2)
374 st2 = fbm(su * 47 - 3.1, sv * 6.0 - t * 1.35, 2)
375 gm = smooth(0.40, 0.85, st1)
376 su = su + (st1 - 0.5) * 0.011 * gm + (st2 - 0.5) * 0.004
377 sv = sv + (st2 - 0.5) * 0.004 * gm
379 ff = 1.3
380 v0 = 0.02
381 camh = 1.6
382 fl_mask = step(sv, v0)
383 zf = camh * ff / max(v0 - sv, 0.0008)
384 wx = su * zf / ff
385 za = 1.7 * ff / max(sv - v0, 0.0008)
386 wa = su * za / ff
388 # ---- platform floor
389 n1 = fbm(wx * 2.0 + 31.7, zf * 0.6, 2)
390 con = 0.70 + 0.55 * n1
391 jz = exp(-abs(fract(zf * 0.25 + 0.5) - 0.5) * 60) * step(zf, 45)
392 con = con * (1 - 0.38 * jz)
393 pR = 0.058 * con
394 pG = 0.070 * con
395 pB = 0.095 * con
396 safe = step(2.02, wx) * step(wx, 2.26) * (0.45 + 0.55 * n1)
397 pR = pR + safe * 0.135
398 pG = pG + safe * 0.105
399 pB = pB + safe * 0.020
400 eh = exp(-abs(wx - 2.58) * 26)
401 edg = exp(-abs(zf - min(zh, 70)) * 0.05)
402 pR = pR + eh * (0.075 + hl2 * 0.9 * edg)
403 pG = pG + eh * (0.095 + hl2 * 0.8 * edg)
404 pB = pB + eh * (0.125 + hl2 * 0.55 * edg)
405 dv2 = (wx + 0.95) * (wx + 0.95) * 1.6 + (zf - 6.8) * (zf - 6.8) * 0.28
406 g2 = exp(-dv2 * 1.4)
407 pR = pR + g2 * 0.50
408 pG = pG + g2 * 0.34
409 pB = pB + g2 * 0.16
410 db2 = (wx - 0.40) * (wx - 0.40) * 2.2 + (zf - 9.5) * (zf - 9.5) * 0.16
411 g3 = exp(-db2 * 0.8) * 0.55 * (0.85 + 0.15 * flick)
412 pR = pR + g3 * 0.50
413 pG = pG + g3 * 0.22
414 pB = pB + g3 * 0.045
415 mf = fbm(wx * 0.5 - t * 0.05, zf * 0.10 + 3.7, 1) * exp(-(v0 - sv) * 7) * fogA
416 pR = pR + mf * 0.030
417 pG = pG + mf * 0.040
418 pB = pB + mf * 0.062
419 pR = pR + hl2 * exp(-zf * 0.045) * 0.10
420 pG = pG + hl2 * exp(-zf * 0.045) * 0.085
421 pB = pB + hl2 * exp(-zf * 0.045) * 0.060
422 fade = exp(-zf * 0.030)
423 pR = mix(0.014, pR, fade)
424 pG = mix(0.020, pG, fade)
425 pB = mix(0.042, pB, fade)
427 # ---- track bed beyond the platform edge
428 g1 = fbm(wx * 5.0, zf * 2.0, 1)
429 tcon = 0.55 + 0.9 * g1
430 tR = 0.018 * tcon
431 tG = 0.022 * tcon
432 tB = 0.032 * tcon
433 sl = step(0.72, fract(zf / 0.75)) * exp(-zf * 0.05)
434 tR = tR + sl * 0.010
435 tG = tG + sl * 0.010
436 tB = tB + sl * 0.012
437 ra = exp(-abs(wx - 3.45) * 40) + exp(-abs(wx - 4.35) * 40)
438 rglow = 0.14 + hl2 * (exp(-abs(zf - zh) * 0.05) * 1.8 + exp(-zf * 0.02) * 0.35)
439 tR = tR + ra * rglow
440 tG = tG + ra * rglow * 0.88
441 tB = tB + ra * rglow * 0.62
442 tR = mix(0.014, tR, fade)
443 tG = mix(0.020, tG, fade)
444 tB = mix(0.042, tB, fade)
445 pm = step(wx, 2.58)
446 fR = mix(tR, pR, pm)
447 fG = mix(tG, pG, pm)
448 fB = mix(tB, pB, pm)
450 # ---- awning underside overhead, else the open night at the end of the hall
451 awn = step(za, 42) * step(-2.3, wa) * step(wa, 1.95)
452 rb = exp(-abs(fract(za / 6 + 0.5) - 0.5) * 40)
453 aR = 0.013 * (1 - 0.4 * rb)
454 aG = 0.016 * (1 - 0.4 * rb)
455 aB = 0.023 * (1 - 0.4 * rb)
456 ed = exp(-abs(za - 42) * 2.5)
457 aR = aR + ed * 0.030
458 aG = aG + ed * 0.038
459 aB = aB + ed * 0.055
460 kk = smooth(v0, v0 + 0.30, sv)
461 sR = mix(0.020, 0.004, kk)
462 sG = mix(0.028, 0.006, kk)
463 sB = mix(0.058, 0.016, kk)
464 hz = exp(-abs(sv - v0 - 0.032) * 24)
465 sR = sR + hz * 0.045
466 sG = sG + hz * 0.028
467 sB = sB + hz * 0.010
468 opb = step(v0 + 0.002, sv) * step(sv, v0 + 0.024)
469 sR = mix(sR, 0.012, opb * 0.85)
470 sG = mix(sG, 0.014, opb * 0.85)
471 sB = mix(sB, 0.022, opb * 0.85)
472 el = exp(-abs(sv - v0 - 0.024) * 800)
473 sR = sR + el * 0.05
474 sG = sG + el * 0.06
475 sB = sB + el * 0.08
476 h1 = hash(floor(su * 420) * 1.31 + floor(sv * 420) * 57.7)
477 st = step(0.9974, h1) * step(v0 + 0.09, sv) * (1 - awn)
478 tw = 0.35 + 0.3 * sin(t * 2.2 + h1 * 40)
479 sR = sR + st * tw * 0.5
480 sG = sG + st * tw * 0.55
481 sB = sB + st * tw * 0.65
482 cR = mix(sR, aR, awn)
483 cG = mix(sG, aG, awn)
484 cB = mix(sB, aB, awn)
486 # ---- merge floor / ceiling and lay the base
487 rgb(mix(cR, fR, fl_mask), mix(cG, fG, fl_mask), mix(cB, fB, fl_mask))
489 # ---- six fluorescent tubes, reflections in the wet floor, spill on the awning
490 repeat i 6 {
491 z1 = 4 + i * 6
492 z2 = z1 + 4
493 zm = z1 + 2
494 ax = 0.3 * ff / z1
495 ay = v0 + 1.45 * ff / z1
496 bx = 0.3 * ff / z2
497 by = v0 + 1.45 * ff / z2
498 dx = bx - ax
499 dy = by - ay
500 tt = clamp(((su - ax) * dx + (sv - ay) * dy) / (dx * dx + dy * dy), 0, 1)
501 dd = len(su - ax - dx * tt, sv - ay - dy * tt)
502 ii = mix(1.0, flick, step(abs(i - 1), 0.5))
503 ii = ii * (0.96 + 0.04 * sin(t * 57 + i * 2.1))
504 ss = 0.016 * ff / zm + 0.0028
505 core = exp(-dd * dd / (2 * ss * ss))
506 halo = exp(-dd * (4 + zm * 2.2))
507 cadd(core * 1.15 * ii + halo * 0.22 * ii, core * 1.35 * ii + halo * 0.34 * ii, core * 1.25 * ii + halo * 0.30 * ii)
508 rf = exp(-abs(wx - 0.3) * (1.7 + zf * 0.30)) * exp(-abs(zf - zm) * 0.42) * fl_mask
509 cadd(rf * 0.28 * ii, rf * 0.42 * ii, rf * 0.37 * ii)
510 sp = exp(-((wa - 0.3) * (wa - 0.3) * 1.4 + (za - zm) * (za - zm) * 0.20)) * (1 - fl_mask) * awn
511 cadd(sp * 0.13 * ii, sp * 0.20 * ii, sp * 0.18 * ii)
512 }
514 # ---- three sodium lamps on the far platform, with wet streak reflections
515 repeat i 3 {
516 lz = 28 + i * 26
517 lx = 4.3 * ff / lz
518 ly = v0 + 1.5 * ff / lz
519 ld2 = (su - lx) * (su - lx) + (sv - ly) * (sv - ly)
520 s_ = 0.05 * ff / lz + 0.0015
521 lg = exp(-ld2 / (2 * s_ * s_))
522 cadd(lg * 1.1, lg * 0.75, lg * 0.32)
523 rst = exp(-abs(su - lx) * 240) * exp(-(v0 - sv) * 11) * fl_mask
524 cadd(rst * 0.12, rst * 0.09, rst * 0.04)
525 }
527 # ---- the vending machine: trapezoid at x=-0.95, z 6..7.6, humming steady
528 m1 = -0.95 * ff / 6.0
529 m2 = -0.95 * ff / 7.6
530 mt = clamp((su - m1) / (m2 - m1), 0, 1)
531 mz = mix(6.0, 7.6, mt)
532 mtop = v0 + 0.35 * ff / mz
533 mbot = v0 - 1.6 * ff / mz
534 mv = (sv - mbot) / max(mtop - mbot, 0.001)
535 medge = smooth(0, 0.03, mt) * smooth(1, 0.97, mt) * smooth(0, 0.04, mv) * smooth(1, 0.96, mv)
536 msk = step(m1, su) * step(su, m2) * step(0, mv) * step(mv, 1) * medge
537 inR = 0.045
538 inG = 0.050
539 inB = 0.065
540 pan = step(0.10, mt) * step(mt, 0.90) * step(0.14, mv) * step(mv, 0.86)
541 pu = (mt - 0.10) / 0.80
542 pv = (mv - 0.14) / 0.72
543 inR = mix(inR, 0.58, pan)
544 inG = mix(inG, 0.64, pan)
545 inB = mix(inB, 0.70, pan)
546 sh = step(fract(pv * 3), 0.10) * pan
547 inR = inR * (1 - 0.5 * sh)
548 inG = inG * (1 - 0.5 * sh)
549 inB = inB * (1 - 0.5 * sh)
550 cellx = fract(pu * 4)
551 celly = fract(pv * 3)
552 item = smooth(0.12, 0.30, cellx) * smooth(0.88, 0.70, cellx) * smooth(0.18, 0.34, celly) * smooth(0.82, 0.66, celly) * pan
553 cid = floor(pu * 4) + floor(pv * 3) * 7
554 chh = hash(cid * 3.7 + 2.1)
555 warm = step(0.30, chh) * step(chh, 0.62)
556 cyan = step(0.62, chh)
557 dark = step(chh, 0.30)
558 itR = (warm * 0.95 + cyan * 0.30) * (1 - dark * 0.85)
559 itG = (warm * 0.55 + cyan * 0.75) * (1 - dark * 0.85)
560 itB = (warm * 0.25 + cyan * 0.85) * (1 - dark * 0.85)
561 inR = inR + item * itR * 0.8
562 inG = inG + item * itG * 0.8
563 inB = inB + item * itB * 0.8
564 br = step(0.88, mv)
565 inR = mix(inR, 0.55, br)
566 inG = mix(inG, 0.10, br)
567 inB = mix(inB, 0.12, br)
568 strp = exp(-abs(mt - 0.88) * 26) * pan
569 inR = inR + strp * 0.55
570 inG = inG + strp * 0.60
571 inB = inB + strp * 0.65
572 sheen = exp(-abs(mt - 0.25 - mv * 0.35) * 9) * 0.10
573 inR = inR + sheen
574 inG = inG + sheen
575 inB = inB + sheen
576 side = smooth(0.80, 1.0, mt)
577 inR = inR * (1 - 0.45 * side)
578 inG = inG * (1 - 0.45 * side)
579 inB = inB * (1 - 0.45 * side)
580 r0 = cget(0)
581 g0 = cget(1)
582 b0 = cget(2)
583 rgb(mix(r0, inR, msk), mix(g0, inG, msk), mix(b0, inB, msk))
584 hd = len(su - clamp(su, m1, m2), sv - clamp(sv, mbot, mtop))
585 halo2 = exp(-hd * 20) * 0.36
586 cadd(halo2 * 0.38, halo2 * 0.42, halo2 * 0.47)
588 # ---- the departure board: split-flap, amber, says what it says
589 b1 = -0.28 * ff / 7.0
590 b2 = 1.32 * ff / 7.0
591 bbot = v0 + 0.40 * ff / 7.0
592 btop = v0 + 1.15 * ff / 7.0
593 bu = (su - b1) / (b2 - b1)
594 bv = (sv - bbot) / (btop - bbot)
595 bedge = smooth(0, 0.03, bu) * smooth(1, 0.97, bu) * smooth(0, 0.05, bv) * smooth(1, 0.95, bv)
596 bmask = step(0, bu) * step(bu, 1) * step(0, bv) * step(bv, 1) * bedge
597 bord = step(bu, 0.04) + step(0.96, bu) + step(bv, 0.07) + step(0.93, bv)
598 r1v = cget(0)
599 g1v = cget(1)
600 b1v = cget(2)
601 bc = 0.014 + bord * 0.030
602 rgb(mix(r1v, bc, bmask), mix(g1v, bc * 0.9, bmask), mix(b1v, bc * 0.8, bmask))
603 boardline(su, sv, TITLE, 10, bbot + 0.55 * (btop - bbot), bbot + 0.92 * (btop - bbot), 2.2, bmask)
604 boardline(su, sv, SUB, 7, bbot + 0.10 * (btop - bbot), bbot + 0.46 * (btop - bbot), 3.6, bmask)
605 # mounting rods up to the awning
606 rod = (step(abs(su - 0.005), 0.0012) + step(abs(su - 0.135), 0.0012)) * step(btop, sv) * step(sv, v0 + 1.7 * ff / 7.0)
607 cmul(1 - 0.55 * clamp(rod, 0, 1))
608 # amber halo off the board face
609 bh = exp(-len(su - 0.096, sv - 0.164) * 9) * 0.10 * (0.85 + 0.15 * flick)
610 cadd(bh * 0.9, bh * 0.42, bh * 0.10)
612 # ---- the one who waits, and their reflection in the wet concrete
613 dfig = figd(su, sv)
614 fill = smooth(0.0018, -0.0018, dfig)
615 r2v = cget(0)
616 g2v = cget(1)
617 b2v = cget(2)
618 rgb(mix(r2v, 0.010, fill), mix(g2v, 0.012, fill), mix(b2v, 0.020, fill))
619 fillS = smooth(0.0018, -0.0018, figd(su - 0.006, sv))
620 rimL = clamp(fill - fillS, 0, 1)
621 cadd(rimL * 0.50, rimL * 0.30, rimL * 0.13)
622 fillU = smooth(0.0018, -0.0018, figd(su, sv + 0.006))
623 rimU = clamp(fill - fillU, 0, 1)
624 cadd(rimU * 0.16, rimU * 0.22, rimU * 0.30)
625 fillS2 = smooth(0.0018, -0.0018, figd(su + 0.007, sv))
626 rimR = clamp(fill - fillS2, 0, 1) * hl2
627 cadd(rimR * 1.0, rimR * 0.85, rimR * 0.55)
628 # phone glow, checked one more time
629 pgu = su - (0.04105 + sway * 0.13684 + 0.010)
630 pgv = sv + 0.0552
631 pg = exp(-(pgu * pgu + pgv * pgv) / (2 * 0.005 * 0.005)) * (0.7 + 0.3 * sin(t * 0.9)) * 0.12 * fill
632 cadd(pg * 0.25, pg * 0.45, pg * 0.75)
633 # breath vapour every ~6.5 s
634 ph = fract(t / 6.5)
635 on = step(ph, 0.4)
636 prad = 0.003 + ph * 0.022
637 bxw = 0.04105 + sway * 0.13684 + 0.021 + ph * 0.007
638 byw = 0.014 + ph * 0.013
639 puff = exp(-((su - bxw) * (su - bxw) + (sv - byw) * (sv - byw)) / (prad * prad)) * (1 - ph / 0.4) * on * 0.07
640 cadd(puff * 0.5, puff * 0.6, puff * 0.75)
641 # reflection: compressed, darkened smudge below the feet
642 dref = figd(su, -0.1989 + (-0.1989 - sv) / 1.8)
643 fill2 = smooth(0.004, -0.004, dref) * fl_mask
644 rgb(mix(cget(0), 0.012, fill2 * 0.40), mix(cget(1), 0.015, fill2 * 0.40), mix(cget(2), 0.022, fill2 * 0.40))
646 # ---- the signal: red until 21 s, then green
647 ssx = 3.9 * ff / 48
648 ssy = v0 + 2.6 * ff / 48
649 ds = len(su - ssx, sv - ssy)
650 sgR = mix(1.0, 0.08, sigG)
651 sgG = mix(0.06, 1.0, sigG)
652 sgB = mix(0.03, 0.25, sigG)
653 lamp = exp(-ds * ds / (2 * 0.0035 * 0.0035)) * 1.4 + exp(-ds * 45) * 0.30
654 cadd(lamp * sgR, lamp * sgG, lamp * sgB)
655 sst = exp(-abs(su - ssx) * 260) * exp(-(v0 - sv) * 10) * fl_mask * 0.25
656 cadd(sst * sgR, sst * sgG, sst * sgB)
658 # ---- and at the end, a light down the track that might be the train
659 repeat i 2 {
660 hx = (3.15 + i * 1.5) * ff / zh
661 hy = v0 - 0.6 * ff / zh
662 dh = len(su - hx, sv - hy)
663 s1 = 0.30 * ff / zh
664 s2 = 1.5 * ff / zh
665 inten = 0.7 + 8 * hl2
666 hg = exp(-dh * dh / (2 * s1 * s1)) * 2.2 * inten + exp(-dh / s2) * 0.22 * inten
667 cadd(hg * 1.15, hg * 1.0, hg * 0.72)
668 }
669 fgx = su - 3.9 * ff / zh
670 fgy = sv - (v0 - 0.6 * ff / zh)
671 fg2 = exp(-len(fgx, fgy) / (6 * ff / zh)) * (0.08 + 0.55 * hl2)
672 cadd(fg2 * 0.9, fg2 * 0.8, fg2 * 0.6)
674 # ---- grade: gentle beat breath, cold shadows, night exposure
675 cmul(1.10 + 0.05 * kickE + 0.08 * hl2)
676}
678post {
679 # bloom, slanted rain streaks past the glass, chroma at the edges, grain
680 b = tap(-3, 0) + tap(3, 0) + tap(0, -3) + tap(0, 3) + tap(-4, -4) + tap(4, 4) + tap(-4, 4) + tap(4, -4)
681 bl = b * 0.125
682 d = len(u, v)
683 rr2 = tap(2, 0)
684 bb2 = tap(-2, 0)
685 bonly = r2
686 rs = step(0.9865, hash(floor((x + y * 0.06) * 170) * 1.73 + floor(y * 7 - t * 12) * 0.713)) * rainA
687 r0 = mix(cget(0), rr2, 0.55 * d) + bl * 0.38 + rs * 0.09
688 g0 = cget(1) + bl * 0.34 + rs * 0.11
689 b0 = mix(cget(2), bonly, 0.55 * d) + bl * 0.42 + rs * 0.13
690 rgb(r0, g0, b0)
691 cmul(1 - 0.40 * d * d)
692 gr = (hash(x * 913.7 + y * 719.3 + frame * 0.371) - 0.5) * 0.045
693 cadd(gr + 0.003, gr + 0.004, gr + 0.009)
694}
Click a line number to link to that line.