PLATFORM
platform.dmt · 120 BPM · 30 s · 960×600
model-madesame brief
notes
one-point perspective from inside the shelter: receding fluorescent battens, five analytic surfaces, a figure with a suitcase, vending machine and a headlight that grows down the tunnel but never arrives
| file | platform.dmt |
|---|---|
| duration | 0:30 |
| video | 960×600 · 30 fps · h264 + audio · 14 MB |
| song | 120 BPM · speed 6 · rpb 4 · 8 channels |
| loop | 0 |
| render | scale 2 · dither on · master 0.62 |
| uniforms | kickE tickE arpE bellE trainA board titleA |
| model | DeepSeek V4.1 Flash |
| collection | Same brief, six models |
| tags | model-madesame brief |
| source | 1,157 lines · 37 KB · download |
anatomy
16VM programs
15patterns
0palettes
12timeline events
1text / sample / texture
1,157source lines
8inst
4chan
1master
1frame
1pixel
1post
4fn
line composition
pixel 36%pattern 26%post 22%fn 6%inst 5%chan 2%master 1%frame 1%timeline 1%title 0%song 0%order 0%pan 0%uniform 0%text 0%
play order
01234567891011121314
order list · 15 entries
timeline
| at | event | value | source | |
|---|---|---|---|---|
| 0:00 | train | 0.00 | L18 | |
| 0:00 | board | 0 | L18 | |
| 0:16 | train | 0.02 | L19 | |
| 0:16 | board | 0 | L19 | |
| 0:18 | train | 0.10 | L20 | |
| 0:18 | board | 1 | L20 | |
| 0:22 | train | 0.30 | L21 | |
| 0:22 | board | 1 | L21 | |
| 0:26 | train | 0.62 | L22 | |
| 0:26 | board | 2 | L22 | |
| 0:28 | train | 1.00 | L23 | |
| 0:28 | board | 2 | L23 |
Event times are derived from the order list, pattern lengths, BPM and RPB.
resources
| kind | name | info | value |
|---|---|---|---|
| text | word | 8 | PLATFORM |
source
1# @model DeepSeek V4.1 Flash
2# @collection Same brief, six models
3# @description one-point perspective from inside the shelter: receding fluorescent battens, five analytic surfaces, a figure with a suitcase, vending machine and a headlight that grows down the tunnel but never arrives
4# @tags brief
5# platform.dmt - 04:00, a station platform seen through rain on the glass.
6# 120 bpm, 15 bars of 2 s = exactly 30 s. One continuous shot, no cuts.
7title PLATFORM
9song bpm=120 speed=6 rpb=4 channels=8 loop=0 volume=0.62 scale=2 dither=1
10order 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14
11pan 0.44 0.58 0.66 0.50 0.60 0.50 0.50 0.42
13text word "PLATFORM"
15# ------------------------------------------------------------------ timeline
16# order:row. The last train is late; the headlight only starts to grow at 18 s.
17timeline {
18 0:00 train=0.00 board=0
19 8:00 train=0.02 board=0
20 9:00 train=0.10 board=1
21 11:00 train=0.30 board=1
22 13:00 train=0.62 board=2
23 14:00 train=1.00 board=2
24}
26# ------------------------------------------------------------------ instruments
27# 1 soft heartbeat 2 clock tick 3 sub 4 pad 5 FM bell 6 glass arp
28# 7 rain on glass 8 approaching train
30inst heart {
31 f = 40 + 70 * exp(-t * 13)
32 $p = $p + f / sr
33 body = sin($p * tau) * exp(-t * 3.4)
34 thud = lp(noise(), 220) * exp(-t * 22) * 0.18
35 out(dist((body * 1.5 + thud), 1.12) * 0.62)
36}
38inst tick {
39 # a clock, or water finding a gutter: a short filtered click with a faint pitch
40 e = exp(-t * 85)
41 n = hp(noise(), 3200) * 0.55 + sin(tau * 1750 * t) * 0.25
42 out(n * e * 0.20)
43}
45inst sub {
46 e = env(0.025, 0.90, 0.58, 0.90)
47 s = sin(ph * tau) * 0.9 + sin(ph * tau * 2.004) * 0.16
48 s = lp(s, 150 + 320 * e)
49 out(dist(s * e, 1.10) * 0.52)
50}
52inst pad nna=continue {
53 e = env(0.85, 1.40, 0.56, 2.40)
54 det = 0.0018 + 0.0008 * sin(t * 0.07)
55 a = sin(ph * tau) * 0.50
56 a = a + saw(ph + det) * 0.26 + saw(ph - det * 0.8) * 0.26
57 a = a + sin(ph * tau * 2.002) * 0.08
58 s = svf(a, 360 + 1500 * e * (0.45 + 0.55 * p0), 0.32)
59 s = s + r2 * 0.38
60 out(s * e * 0.19)
61}
63inst bell nna=continue {
64 e = env(0.002, 1.6, 0.20, 2.6)
65 idx = 1.7 * exp(-t * 1.1) + 0.16
66 m = sin(ph * tau * 2.01) * idx
67 a = sin(ph * tau + m) * 0.70 + sin(ph * tau * 3.99) * 0.16 * exp(-t * 2.0)
68 out(a * e * 0.30)
69}
71inst arp {
72 e = env(0.002, 0.16, 0.0, 0.12)
73 m = sin(ph * tau * 3.0) * 2.0 * exp(-t * 9)
74 a = sin(ph * tau + m) + sin(ph * tau * 2.0) * 0.10
75 out(a * e * 0.20)
76}
78inst rain nna=continue {
79 e = env(2.4, 1.2, 0.88, 3.0)
80 n = noise()
81 hi = hp(n, 1400) * 0.45
82 lo = lp(n, 380) * 0.55
83 g = 0.66 + 0.22 * sin(t * 0.19) + 0.12 * sin(t * 0.53 + 2.1)
84 out((hi + lo) * e * g * 0.48)
85}
87inst train nna=continue {
88 # long attack, low rumble and a thin steel shimmer on top
89 e = env(8.0, 2.0, 0.92, 2.0)
90 sub = sin(tau * 29 * t) * 0.55 + sin(tau * 43.5 * t) * 0.30
91 rum = lp(noise(), 110) * 1.4 + lp(noise(), 420) * 0.32
92 shm = hp(noise(), 5200) * (0.10 + 0.14 * sin(t * 1.3))
93 out(dist((sub + rum + shm) * e, 1.25) * 0.46)
94}
96# ------------------------------------------------------------------ channel fx
97chan 0 {
98 # pad: one long hall, dark
99 v = verb(x, 0.87, 0.46)
100 out(x + v * 0.55)
101}
103chan 1 {
104 # bell: dotted-eighth repeats
105 d = dly(x, 0.375, 0.34)
106 v = verb(x, 0.86, 0.42)
107 out(x + d * 0.30 + v * 0.50)
108}
110chan 2 {
111 # arp: short room, a little echo
112 d = dly(x, 0.1875, 0.30)
113 out(x + d * 0.28)
114}
116chan 6 {
117 # rain: lift the air slightly
118 out(hp(x, 90) * 1.05)
119}
121# ------------------------------------------------------------------ master
122master {
123 # the fluorescent hum and the room's hiss live here, always on
124 hum = sin(tau * 100 * t) * 0.60 + sin(tau * 200 * t) * 0.24 + sin(tau * 300 * t) * 0.09
125 hum = hum * (0.55 + 0.45 * sin(tau * 0.31 * t + 0.7))
126 hiss = hp(noise(), 6000) * 0.009
127 dl = dly(l, 0.375, 0.30)
128 dr = dly(r, 0.5625, 0.26)
129 vl = verb(l + dr * 0.20, 0.84, 0.50)
130 vr = verb(r + dl * 0.20, 0.84, 0.50)
131 ol = l + dl * 0.16 + vl * 0.22 + hum * 0.020 + hiss
132 or = r + dr * 0.16 + vr * 0.22 + hum * 0.016 + hiss
133 out(dist(ol * 1.06, 1.18), dist(or * 1.06, 1.18))
134}
136pattern 0 rows=16 {
137 # Dm. 4 a.m.: pad, rain, one bell far away.
138 D-3 4 22 S28 | ... | ... | ... | ... | ... | C-4 7 30 ...
139 ...
140 F-3 4 18 S28
141 ...
142 A-3 4 18 S28
143 ...
144 ...
145 ...
146 ...
147 ...
148 ...
149 ...
150 ... | A-4 5 16 ...
151 ...
152 ...
153 ...
154}
156pattern 1 rows=16 {
157 # Bb
158 Bb2 4 22 S30
159 ...
160 D-3 4 18 S30
161 ...
162 F-3 4 18 S30
163 ...
164 ...
165 ...
166 ... | D-5 5 14 ...
167 ...
168 ...
169 ...
170 ...
171 ...
172 ...
173 ...
174}
176pattern 2 rows=16 {
177 # Gm. the heartbeat and the clock begin.
178 G-2 4 22 S32 | ... | ... | C-2 1 0C ... | C-6 2 06 ... | G-1 3 1A ...
179 ...
180 Bb2 4 18 S32
181 ...
182 D-3 4 18 S32 | ... | ... | ... | C-6 2 06 ...
183 ...
184 ...
185 ...
186 ... | ... | ... | C-2 1 0C ... | C-6 2 06 ...
187 ...
188 ...
189 ...
190 ... | ... | ... | ... | C-6 2 06 ...
191 ...
192 ...
193 ...
194}
196pattern 3 rows=16 {
197 # A major: the first small lift.
198 A-2 4 22 S36 | ... | ... | C-2 1 0C ... | C-6 2 06 ... | A-1 3 1A ...
199 ...
200 C#3 4 18 S36
201 ...
202 E-3 4 18 S36 | ... | ... | ... | C-6 2 06 ...
203 ...
204 ... | A-4 5 15 ...
205 ...
206 ... | ... | ... | C-2 1 0C ... | C-6 2 06 ...
207 ...
208 ...
209 ...
210 ... | ... | ... | ... | C-6 2 06 ...
211 ...
212 ...
213 ...
214}
216pattern 4 rows=16 {
217 # Dm. a phrase in the bell.
218 D-3 4 22 S30 | ... | ... | C-2 1 0C ... | C-6 2 06 ... | D-1 3 1A ...
219 ...
220 F-3 4 18 S30
221 ...
222 A-3 4 18 S30 | ... | ... | ... | C-6 2 06 ...
223 ...
224 ...
225 ...
226 ... | A-4 5 17 ... | ... | C-2 1 0C ... | C-6 2 06 ...
227 ...
228 ...
229 ...
230 ... | ... | ... | ... | C-6 2 06 ...
231 ...
232 ... | F-4 5 14 ...
233 ...
234}
236pattern 5 rows=16 {
237 # Bb
238 Bb2 4 22 S34 | ... | ... | C-2 1 0C ... | C-6 2 06 ... | Bb1 3 1A ...
239 ...
240 D-3 4 18 S34
241 ...
242 F-3 4 18 S34 | D-5 5 16 ... | ... | ... | C-6 2 06 ...
243 ...
244 ...
245 ...
246 ... | ... | ... | C-2 1 0C ... | C-6 2 06 ...
247 ...
248 ...
249 ...
250 ... | C-5 5 13 ... | ... | ... | C-6 2 06 ...
251 ...
252 ... | ... | ... | C-2 1 0A ...
253 ...
254}
256pattern 6 rows=16 {
257 # Gm. the arp starts, slow eighths.
258 G-2 4 22 S32 | ... | G-4 6 0A ... | C-2 1 0C ... | C-6 2 05 ... | G-1 3 1A ...
259 ...
260 Bb2 4 18 S32 | ... | Bb4 6 0A ... | ... | C-6 2 05 ...
261 ...
262 D-3 4 18 S32 | ... | D-5 6 0A ... | ... | C-6 2 05 ...
263 ...
264 ... | ... | Bb4 6 0A ... | ... | C-6 2 05 ...
265 ...
266 ... | ... | G-4 6 0A ... | C-2 1 0C ... | C-6 2 05 ...
267 ...
268 ... | ... | Bb4 6 0A ... | ... | C-6 2 05 ...
269 ...
270 ... | ... | D-5 6 0A ... | ... | C-6 2 05 ...
271 ...
272 ... | ... | Bb4 6 0A ... | ... | C-6 2 05 ...
273 ...
274}
276pattern 7 rows=16 {
277 # A
278 A-2 4 22 S38 | ... | A-4 6 0A ... | C-2 1 0C ... | C-6 2 05 ... | A-1 3 1A ...
279 ...
280 C#3 4 18 S38 | ... | C#5 6 0A ... | ... | C-6 2 05 ...
281 ...
282 E-3 4 18 S38 | ... | E-5 6 0A ... | ... | C-6 2 05 ...
283 ...
284 ... | ... | C#5 6 0A ... | ... | C-6 2 05 ...
285 ...
286 ... | E-5 5 15 ... | A-4 6 0A ... | C-2 1 0C ... | C-6 2 05 ...
287 ...
288 ... | ... | C#5 6 0A ... | ... | C-6 2 05 ...
289 ...
290 ... | ... | E-5 6 0A ... | ... | C-6 2 05 ...
291 ...
292 ... | ... | C#5 6 0A ... | ... | C-6 2 05 ...
293 ...
294}
296pattern 8 rows=16 {
297 # Dm, warmer now.
298 D-3 4 22 S32 | ... | D-5 6 0A ... | C-2 1 0C ... | C-6 2 05 ... | D-1 3 1A ...
299 ...
300 F-3 4 18 S32 | ... | F-5 6 0A ... | ... | C-6 2 05 ...
301 ...
302 A-3 4 18 S32 | ... | A-5 6 0A ... | ... | C-6 2 05 ...
303 ...
304 ... | ... | F-5 6 0A ... | C-2 1 0A ... | C-6 2 05 ...
305 ...
306 ... | ... | D-5 6 0A ... | C-2 1 0C ... | C-6 2 05 ...
307 ...
308 ... | ... | F-5 6 0A ... | ... | C-6 2 05 ...
309 ...
310 ... | F-5 5 16 ... | A-5 6 0A ... | ... | C-6 2 05 ...
311 ...
312 ... | ... | D-6 6 0A ... | C-2 1 0A ... | C-6 2 05 ...
313 ...
314}
316pattern 9 rows=16 {
317 # Bb. the train enters far away.
318 Bb2 4 22 S34 | ... | Bb4 6 0A ... | C-2 1 0C ... | C-6 2 05 ... | Bb1 3 1B ... | ... | C-2 8 20 ...
319 ...
320 D-3 4 18 S34 | ... | D-5 6 0A ... | ... | C-6 2 05 ...
321 ...
322 F-3 4 18 S34 | ... | F-5 6 0A ... | ... | C-6 2 05 ...
323 ...
324 ... | ... | D-5 6 0A ... | ... | C-6 2 05 ...
325 ...
326 ... | D-5 5 15 ... | Bb4 6 0A ... | C-2 1 0C ... | C-6 2 05 ...
327 ...
328 ... | ... | D-5 6 0A ... | ... | C-6 2 05 ...
329 ...
330 ... | ... | F-5 6 0A ... | ... | C-6 2 05 ...
331 ...
332 ... | ... | Bb5 6 0A ... | ... | C-6 2 05 ...
333 ...
334}
336pattern 10 rows=16 {
337 # Gm. the pulse quickens.
338 G-2 4 22 S36 | ... | G-5 6 0A ... | C-2 1 0C ... | C-6 2 05 ... | G-1 3 1B ...
339 ...
340 Bb2 4 18 S36 | ... | Bb5 6 0A ... | ... | C-6 2 05 ...
341 ...
342 D-3 4 18 S36 | ... | D-6 6 0A ... | C-2 1 0A ... | C-6 2 05 ...
343 ...
344 ... | Bb4 5 14 ... | Bb5 6 0A ... | ... | C-6 2 05 ...
345 ...
346 ... | ... | G-5 6 0A ... | C-2 1 0C ... | C-6 2 05 ...
347 ...
348 ... | ... | Bb5 6 0A ... | ... | C-6 2 05 ...
349 ...
350 ... | ... | D-6 6 0A ... | C-2 1 0A ... | C-6 2 05 ...
351 ...
352 ... | ... | Bb5 6 0A ... | ... | C-6 2 05 ...
353 ...
354}
356pattern 11 rows=16 {
357 # A. the light is coming.
358 A-2 4 22 S3A | ... | A-5 6 0A ... | C-2 1 0C ... | C-6 2 05 ... | A-1 3 1B ...
359 ...
360 C#3 4 18 S3A | ... | C#6 6 0A ... | ... | C-6 2 05 ...
361 ...
362 E-3 4 18 S3A | ... | E-6 6 0A ... | C-2 1 0A ... | C-6 2 05 ...
363 ...
364 ... | C#6 5 17 ... | C#6 6 0A ... | ... | C-6 2 05 ...
365 ...
366 ... | ... | A-5 6 0A ... | C-2 1 0C ... | C-6 2 05 ...
367 ...
368 ... | ... | C#6 6 0A ... | ... | C-6 2 05 ...
369 ...
370 ... | ... | E-6 6 0A ... | C-2 1 0A ... | C-6 2 05 ...
371 ...
372 ... | ... | A-6 6 0A ... | ... | C-6 2 05 ...
373 ...
374}
376pattern 12 rows=16 {
377 # Eb: the ceiling seems higher for a moment.
378 Eb3 4 22 S3E | ... | Eb5 6 0A ... | C-2 1 0C ... | C-6 2 05 ... | Eb1 3 1B ...
379 ...
380 G-3 4 18 S3E | ... | G-5 6 0A ... | ... | C-6 2 05 ...
381 ...
382 Bb3 4 18 S3E | ... | Bb5 6 0A ... | C-2 1 0A ... | C-6 2 05 ...
383 ...
384 ... | G-5 5 17 ... | G-5 6 0A ... | C-2 1 0A ... | C-6 2 05 ...
385 ...
386 ... | ... | Eb5 6 0A ... | C-2 1 0C ... | C-6 2 05 ...
387 ...
388 ... | ... | G-5 6 0A ... | ... | C-6 2 05 ...
389 ...
390 ... | ... | Bb5 6 0A ... | C-2 1 0A ... | C-6 2 05 ...
391 ...
392 ... | ... | Eb6 6 0A ... | C-2 1 0A ... | C-6 2 05 ...
393 ...
394}
396pattern 13 rows=16 {
397 # A7: the last train is a promise, not an arrival.
398 A-2 4 22 S42 | ... | A-5 6 09 ... | C-2 1 0C ... | C-6 2 05 ... | A-1 3 1B ...
399 C#3 4 18 S42
400 E-3 4 18 S42 | ... | C#6 6 09 ... | C-2 1 0A ... | C-6 2 05 ...
401 G-3 4 18 S42
402 ... | A-5 5 18 ... | E-6 6 09 ... | C-2 1 0A ... | C-6 2 05 ...
403 ...
404 ... | ... | A-6 6 09 ... | C-2 1 0A ... | C-6 2 05 ...
405 ...
406 ... | ... | E-6 6 09 ... | C-2 1 0C ... | C-6 2 05 ...
407 ...
408 ... | E-6 5 15 ... | C#6 6 09 ... | C-2 1 0A ... | C-6 2 05 ...
409 ...
410 ... | ... | A-5 6 09 ... | C-2 1 0A ... | C-6 2 05 ...
411 ...
412 ... | ... | E-6 6 09 ... | C-2 1 0A ... | C-6 2 05 ...
413 ...
414}
416pattern 14 rows=16 {
417 # Dm add 9. everything rings into the last sample.
418 D-3 4 22 S3C | ... | D-5 6 09 ... | C-2 1 0C ... | C-6 2 05 ... | D-1 3 1B ...
419 ...
420 F-3 4 18 S3C | ... | F-5 6 09 ...
421 ...
422 A-3 4 18 S3C | ... | A-5 6 09 ... | ... | C-6 2 05 ...
423 E-4 4 18 S3C
424 ... | ... | D-6 6 09 ...
425 ...
426 ... | D-6 5 18 ... | ... | C-2 1 0C ... | C-6 2 05 ...
427 ...
428 ...
429 ...
430 ... | A-5 5 13 ... | ... | ... | C-6 2 05 ...
431 ...
432 ...
433 ...
434}
436# ------------------------------------------------------------------ visuals
437# One analytic camera on a platform: floor, ceiling, right wall and the far wall
438# are selected per pixel by nearest intersection. Fluorescent battens recede in
439# z; a vending machine, one waiting figure and rain on the near glass sit on top.
441uniform kickE tickE arpE bellE trainA board titleA
443fn sdbox(px, py, bx, by) {
444 dx = abs(px) - bx
445 dy = abs(py) - by
446 return len(max(dx, 0), max(dy, 0)) + min(max(dx, dy), 0)
447}
449fn sdseg(px, py, ax, ay, cx, cy) {
450 pax = px - ax
451 pay = py - ay
452 bax = cx - ax
453 bay = cy - ay
454 kk = clamp((pax * bax + pay * bay) / (bax * bax + bay * bay + 0.000001), 0, 1)
455 return len(pax - bax * kk, pay - bay * kk)
456}
458fn smin(a, b, k) {
459 hh = clamp(0.5 + 0.5 * (b - a) / k, 0, 1)
460 return mix(b, a, hh) - k * hh * (1 - hh)
461}
463fn fig(px, py) {
464 # signed distance to a person standing with their back to us, in metres.
465 # py is height above the floor (0 at the shoes).
466 sway = 0.010 * sin(time * 0.27) + 0.006 * sin(time * 0.61 + 1.2)
467 bx = px - sway
468 breathe = 1 + 0.005 * sin(time * 1.05)
469 # legs
470 legL = sdseg(bx, py, -0.105, 0.74, -0.125, 0.10) - 0.062
471 legR = sdseg(bx, py, 0.095, 0.74, 0.115, 0.10) - 0.062
472 d = min(legL, legR)
473 # shoes
474 shoeL = len((bx + 0.135) * 1.5, (py - 0.030) * 8.0) - 0.048
475 shoeR = len((bx - 0.125) * 1.5, (py - 0.030) * 8.0) - 0.048
476 d = min(d, min(shoeL, shoeR))
477 # long coat, hem wider than the shoulders
478 cw = 0.195 + 0.075 * smooth(1.46, 0.50, py)
479 coat = sdbox(bx / cw, (py - 0.955) / (0.49 * breathe), 1.0, 1.0) * cw
480 # coat vent: a thin notch at the hem so the legs read
481 vent = sdbox((bx + 0.005) / 0.030, (py - 0.60) / 0.14, 1.0, 1.0) * 0.030
482 coat = max(coat, -vent + 0.020)
483 d = smin(d, coat, 0.040)
484 # sleeves
485 armL = sdseg(bx, py, -0.150, 1.36, -0.225, 0.83) - 0.050
486 armR = sdseg(bx, py, 0.145, 1.36, 0.225, 0.83) - 0.050
487 d = smin(d, min(armL, armR), 0.030)
488 # neck
489 neck = sdbox(bx / 0.043, (py - 1.455) / 0.060, 1.0, 1.0) * 0.043
490 d = smin(d, neck, 0.020)
491 # scarf: a band and a tail that moves in the draft
492 sc = sdbox(bx / 0.128, (py - 1.442) / 0.042, 1.0, 1.0) * 0.042
493 tl = 0.030 * sin(time * 1.5 + 0.7) + 0.012 * sin(time * 3.1)
494 tail = sdseg(bx, py, 0.085, 1.41, 0.115 + tl, 1.18) - 0.032
495 d = smin(d, sc, 0.018)
496 d = smin(d, tail, 0.018)
497 # head, tipping up at the end
498 ha = -0.30 * titleA
499 hx = rot(bx, py - 1.585, ha)
500 hy = r1
501 head = (len(hx / 0.086, hy / 0.108) - 1) * 0.09
502 d = smin(d, head, 0.022)
503 # knitted beanie: crown plus a rolled brim
504 cap = (len((hx + 0.004) / 0.094, (hy - 0.040) / 0.082) - 1) * 0.09
505 brim = sdbox((hx + 0.002) / 0.098, (hy - 0.005) / 0.020, 1.0, 1.0) * 0.020
506 d = min(d, min(cap, brim) + 0.004)
507 return d
508}
510frame {
511 kickE = exp(-trig(3) * 7.0)
512 tickE = exp(-trig(4) * 16.0)
513 arpE = exp(-trig(2) * 7.0)
514 bellE = exp(-trig(1) * 2.4)
515 trainA = evtl(train)
516 board = evt(board)
517 # the title sign settles on over the last two bars
518 titleA = smooth(25.0, 28.5, time)
519 wind = 0.5 + 0.5 * sin(time * 0.23 + 1.0)
520}
522pixel {
523 # engine u,v span [-1.6,1.6] and [-1,1]; work in half units
524 su = u * 0.5
525 sv = v * 0.5
527 # ---------------------------------------------------------------- rain glass
528 # two layers of running drops refract the scene; no overlay fog, only water
529 rox = 0.0
530 roy = 0.0
531 rgli = 0.0
532 rdk = 0.0
534 # large slow drops and their trails
535 q = su * 10.5
536 rw = sv * 7.4 + time * 0.19
537 qi = floor(q)
538 wi = floor(rw)
539 qf = fract(q) - 0.5
540 wf = fract(rw) - 0.5
541 rh = hash(qi * 17.3 + wi * 5.7)
542 ron = step(0.50, rh)
543 rox0 = (hash(qi * 3.7 + wi * 9.1) - 0.5) * 0.38
544 roy0 = (hash(qi * 8.3 + wi * 1.9) - 0.5) * 0.30
545 rrx = 0.13 + 0.20 * hash(qi * 2.1 + wi * 4.3)
546 rry = 0.52 + 0.55 * hash(qi * 6.7 + wi * 3.1)
547 rex = (qf - rox0) / rrx
548 rey = (wf - roy0) / rry
549 rdd = len(rex, rey)
550 rdm = (1 - smooth(0.80, 1.0, rdd)) * ron
551 rox = rox - rex * rdm * 0.013
552 roy = roy - rey * rdm * 0.009
553 # the wet trail a drop leaves above itself
554 rtr = (1 - smooth(0.0, 0.035, abs(qf - rox0))) * step(wf, roy0) * exp((wf - roy0) * 5.0) * ron
555 rox = rox + (hash(qi * 1.7 + 3.0) - 0.5) * rtr * 0.006
556 rgli = rgli + exp(-(rex * rex * 3.5 + (rey - 0.50) * (rey - 0.50) * 5.0) * 7.0) * rdm * 0.55
557 rgli = rgli + exp(-abs(rdd - 0.96) * 16.0) * rdm * 0.55
558 rdk = rdk + exp(-abs(rdd - 0.9) * 10.0) * rdm
559 rgli = rgli + rtr * 0.12
561 # fine beads, sparse
562 q = su * 22.0
563 rw = sv * 17.0 + time * 0.52
564 qi = floor(q)
565 wi = floor(rw)
566 qf = fract(q) - 0.5
567 wf = fract(rw) - 0.5
568 rh = hash(qi * 7.9 + wi * 3.3)
569 ron = step(0.68, rh)
570 rox0 = (hash(qi * 5.1 + wi * 8.7) - 0.5) * 0.40
571 roy0 = (hash(qi * 2.7 + wi * 6.1) - 0.5) * 0.34
572 rrx = 0.14 + 0.16 * hash(qi * 9.3 + wi * 1.7)
573 rry = 0.22 + 0.30 * hash(qi * 4.9 + wi * 5.3)
574 rex = (qf - rox0) / rrx
575 rey = (wf - roy0) / rry
576 rdd = len(rex, rey)
577 rdm = (1 - smooth(0.74, 1.0, rdd)) * ron
578 rox = rox - rex * rdm * 0.006
579 roy = roy - rey * rdm * 0.004
580 rgli = rgli + exp(-(rex * rex * 4.0 + (rey - 0.4) * (rey - 0.4) * 7.0) * 6.0) * rdm * 0.30
582 # long runners: thin columns of water with a bright head
583 q = su * 9.5
584 qi = floor(q)
585 qf = fract(q) - 0.5
586 hh = hash(qi * 4.3 + 1.7)
587 ron = step(0.42, hh)
588 spd = 0.045 + 0.055 * hh
589 heady = 1.05 - 2.10 * fract(hh * 11.0 + time * spd)
590 dxr = qf - (hash(qi * 2.2 + 7.0) - 0.5) * 0.42
591 drr = len(dxr / 0.010, (sv - heady) / 0.13)
592 rm = (1 - smooth(0.55, 1.0, drr)) * ron
593 rox = rox + dxr * 0.006 * rm
594 rgli = rgli + (1 - smooth(0.0, 0.85, drr)) * rm * 0.30
596 # a few still beads of condensation
597 bq = fract(su * 74.0)
598 bw = fract(sv * 74.0)
599 bd = len(bq - 0.5, bw - 0.5)
600 bead = step(0.94, hash(floor(su * 74.0) * 7.1 + floor(sv * 74.0) * 3.7))
601 rgli = rgli + exp(-bd * bd * 22.0) * bead * 0.25
603 uu = su + rox
604 vv = sv + roy
606 # slow push in, and a hand-held breath on the vanishing point
607 up = 0.060 + 0.006 * sin(time * 0.09)
608 vh = 0.040 + 0.003 * sin(time * 0.13 + 0.4)
609 zm = 1.0 + 0.030 * smooth(0.0, 30.0, time)
610 uu = up + (uu - up) / zm
611 vv = vh + (vv - vh) / zm
613 # ---------------------------------------------------------------- geometry
614 HH = 1.55
615 CH = 3.25
616 WR = 2.40
617 WL = 4.65
618 ZB = 34.0
620 zf = HH / max(0.0005, vh - vv)
621 zc = (CH - HH) / max(0.0005, vv - vh)
622 zr = WR / max(0.0005, uu - up)
623 zl = WL / max(0.0005, up - uu)
624 dn = min(min(zf, zc), min(zr, zl))
625 mback = step(ZB, dn)
626 dz = min(dn, ZB)
628 mf = (1 - step(0.02, abs(zf - dz))) * (1 - mback)
629 mc = (1 - step(0.02, abs(zc - dz))) * (1 - mback)
630 mr = (1 - step(0.02, abs(zr - dz))) * (1 - mback)
631 ml = (1 - step(0.02, abs(zl - dz))) * (1 - mback)
632 mb = mback
634 xf = (uu - up) * zf
635 xc = (uu - up) * zc
636 yr = HH + (vv - vh) * zr
637 yl = HH + (vv - vh) * zl
638 xb = (uu - up) * ZB
639 yb = HH + (vv - vh) * ZB
641 px = xf * mf + xc * mc + WR * mr - WL * ml + xb * mb
642 py = 0.0 * mf + CH * mc + yr * mr + yl * ml + yb * mb
643 pz = zf * mf + zc * mc + zr * mr + zl * ml + ZB * mb
645 # ---------------------------------------------------------------- surfaces
646 # floor: concrete slabs, a tactile edge, the track bed with two rails
647 sxa = abs(fract(px / 1.35 + 0.5) - 0.5)
648 sza = abs(fract(pz / 1.35 + 0.5) - 0.5)
649 seam = 1 - smooth(0.0, 0.010, min(sxa, sza))
650 grain = 0.5 + 0.5 * sin(px * 23.0 + pz * 17.0 + sin(px * 3.1) * 2.0)
651 grain = grain * 0.5 + 0.5 * hash(floor(px * 12.0) + floor(pz * 12.0) * 3.1)
652 wet = smooth(0.44, 0.66, 0.5 + 0.5 * sin(px * 0.55 + 1.3) * sin(pz * 0.37 - 0.7))
653 floorA = (0.225 + 0.125 * grain - 0.085 * seam) * (1.0 - 0.18 * wet)
655 # tactile warning strip
656 tacx = step(-2.34, px) * (1 - step(-1.98, px))
657 tdash = 0.5 + 0.5 * sin(px * 42.0 + pz * 3.0)
658 tac = tacx * (0.55 + 0.35 * tdash)
659 floorA = mix(floorA, 0.42 + 0.12 * tdash, tacx * 0.88)
661 # track bed: darker, ballast, sleepers, rails
662 trk = 1 - smooth(-2.42, -2.30, px)
663 trkA = 0.070 + 0.045 * hash(floor(px * 9.0) + floor(pz * 7.0) * 5.3)
664 slp = step(0.45, fract(pz / 0.58)) * 0.020
665 trkA = trkA + slp
666 rail = exp(-abs(px + 2.92) * 55.0) + exp(-abs(px + 3.86) * 55.0)
667 rail = rail * (0.35 + 0.65 * (0.5 + 0.5 * sin(pz * 9.0)))
668 floorA = mix(floorA, trkA, trk)
669 floorA = floorA + rail * (0.16 + 0.9 * trainA) * (1 - trk * 0.2)
671 # right wall: glazed tiles with grout, a darker dado
672 gz = abs(fract(pz / 0.46 + 0.5) - 0.5)
673 gy = abs(fract(py / 0.33 + 0.5) - 0.5)
674 grout = 1 - smooth(0.0, 0.018, min(gz, gy))
675 tilev = hash(floor(pz / 0.46) * 3.7 + floor(py / 0.33) * 8.1)
676 wallA = 0.33 + 0.06 * tilev - 0.16 * grout
677 wallA = wallA * (0.75 + 0.25 * smooth(0.0, 2.8, py))
678 dado = step(py, 0.95) * (1 - smooth(0.90, 0.96, py))
679 wallA = mix(wallA, 0.075 + 0.02 * tilev, dado * 0.9)
681 # the far side of the tracks: a glazed wall with rain on it
682 gmz = abs(fract(pz / 1.85 + 0.5) - 0.5)
683 gmy = abs(fract(py / 1.15 + 0.5) - 0.5)
684 gmul = 1 - smooth(0.0, 0.045, min(gmz * 1.85, gmy * 1.15))
685 gbase = 0.040 + 0.020 * smooth(-1.0, 3.0, py)
686 gbase = mix(gbase, 0.012, gmul)
687 # city lights behind the glass
688 ccity = step(0.93, hash(floor(pz * 7.0) + floor(py * 5.0) * 5.9))
689 ccity = ccity * smooth(0.05, 0.8, py) * (0.5 + 0.5 * sin(time * (0.3 + ccity) + pz * 3.0))
690 gbase = gbase + ccity * 0.16
691 ledge = exp(-abs(py - 0.02) * 70.0) * 0.22
692 gbase = gbase + ledge
693 # rain water running down the inside of the glass
694 gstr = fract(py * 3.0 + pz * 0.6 + time * 0.8)
695 gbase = gbase + exp(-gstr * 9.0) * 0.030
697 # far wall and tunnel mouth
698 far = 0.080 + 0.03 * hash(floor(xb * 3.0) + floor(yb * 3.0) * 7.0)
699 mouth = step(-1.85, xb) * step(xb, 1.35) * step(0.0, yb) * step(yb, 2.75)
700 far = mix(far, 0.004, mouth)
701 # a lit sign band over the tunnel
702 lip = exp(-abs(yb - 2.92) * 55.0) * step(-2.1, xb) * step(xb, 1.6)
703 far = far + lip * 0.55
705 alb = floorA * mf + wallA * mr + gbase * ml + far * (mb + mc * 0.0)
706 alb = alb + 0.060 * mc
707 # back wall is also where the ceiling ends: keep the ceiling dark
708 alb = alb + 0.030 * mc * (0.5 + 0.5 * hash(floor(px * 4.0) + floor(pz * 4.0)))
710 # ---------------------------------------------------------------- lighting
711 tubez = 1.6 + 3.0 * floor((pz - 1.6) / 3.0 + 0.5)
712 tid = floor((pz - 1.6) / 3.0 + 0.5)
713 tfl = 0.78 + 0.22 * hash(tid * 9.1 + 0.7)
714 tfl = tfl * (1 - 0.62 * step(0.90, hash(tid * 4.3 + floor(time * 10.0))))
715 vdist = CH - 0.20 - py
716 tlight = tfl * (0.55 + 0.45 * exp(-abs(pz - tubez) * 0.55))
717 tlight = tlight / (1.0 + max(0.0, vdist) * 0.24)
719 # warm vending light
720 vdx = px - 1.66
721 vdy = py - 1.05
722 vdz = pz - 3.90
723 vd2 = vdx * vdx + vdy * vdy + vdz * vdz
724 vlight = 2.6 / (1.0 + vd2 * 1.45)
726 # headlight in the tunnel
727 tdx = px + 0.25
728 tdy = py - 1.00
729 tdz = pz - (ZB - 2.0)
730 td2 = tdx * tdx + tdy * tdy + tdz * tdz
731 hlight = (0.10 + 26.0 * trainA * trainA) / (1.0 + td2 * 0.16)
733 amb = 0.022 + 0.014 * smooth(-0.5, 3.2, py)
734 # the open left side leaks cold blue
735 cold = smooth(0.5, -3.5, px) * 0.055
737 litr = amb + tlight * 1.02 + vlight * 0.72 + hlight * 0.42 + cold * 0.5
738 litg = amb + tlight * 1.06 + vlight * 0.48 + hlight * 0.40 + cold * 0.8
739 litb = amb + tlight * 1.14 + vlight * 0.26 + hlight * 0.32 + cold * 1.1
741 r = alb * litr
742 g = alb * litg
743 b = alb * litb
745 # the glass wall stays cold and takes the city's colour
746 r = r + gbase * ml * (0.10 + 0.20 * ccity)
747 g = g + gbase * ml * (0.16 + 0.16 * ccity)
748 b = b + gbase * ml * (0.26 + 0.10 * ccity)
750 # the platform lip and the tactile strip, the things that make it a platform
751 taclit = tacx * (0.35 + 0.65 * tdash)
752 r = r + taclit * (0.070 + 0.030 * trainA)
753 g = g + taclit * (0.048 + 0.018 * trainA)
754 b = b + taclit * (0.010 + 0.006 * trainA)
755 lip = exp(-abs(px + 2.34) * 55.0) * mf
756 lip = lip * (0.20 + 0.55 * trainA + 0.15 * sin(pz * 1.7))
757 r = r + lip * 0.34
758 g = g + lip * 0.36
759 b = b + lip * 0.38
760 # a shadow in the gap beyond the lip
761 gap = smooth(-2.62, -2.40, px) * (1 - smooth(-2.40, -2.28, px)) * mf
762 r = r * (1 - gap * 0.55)
763 g = g * (1 - gap * 0.55)
764 b = b * (1 - gap * 0.55)
765 # ballast and sleepers, still wet
766 ball = exp(-abs(px + 3.4) * 0.55) * (1 - smooth(-2.42, -2.34, px)) * mf
767 sl2 = step(0.45, fract(pz / 0.58)) * 0.045
768 r = r + ball * sl2 * 0.5
769 g = g + ball * sl2 * 0.45
770 b = b + ball * sl2 * 0.38
772 # haze in the light under each batten
773 haze = exp(-abs(pz - tubez) * 0.55) * exp(-max(0.0, py) * 0.35) * 0.012
774 r = r + haze * 0.55
775 g = g + haze * 0.75
776 b = b + haze * 1.00
778 # wet floor holds the tube bands and the machine's colour
779 zref = (HH + CH - 0.20) / max(0.001, vh - vv)
780 refband = exp(-abs(fract((zref - 1.6) / 3.0 + 0.5) - 0.5) * 6.0)
781 refl = refband * (0.55 + 0.55 * wet) * mf * (0.30 + 0.55 * trainA)
782 wob = 0.55 + 0.45 * sin(vv * 70.0 + time * 1.7 + px * 3.0)
783 refl = refl * wob / (1.0 + zref * 0.04)
784 r = r + refl * 0.80
785 g = g + refl * 0.92
786 b = b + refl * 1.10
788 # a broad sheen on the wet slabs, and the rails catching the ceiling
789 sheen = exp(-abs(vv + 0.20) * 2.6) * mf * (0.35 + 0.45 * wet) * 0.10
790 r = r + sheen * 0.7
791 g = g + sheen * 0.9
792 b = b + sheen * 1.2
793 railg = exp(-abs(px + 2.92) * 26.0) + exp(-abs(px + 3.86) * 26.0)
794 railg = railg * mf * (0.30 + 0.90 * trainA) * (0.6 + 0.4 * sin(pz * 3.0 + 1.0))
795 r = r + railg * (0.55 + 0.45 * trainA) * 0.8
796 g = g + railg * (0.58 + 0.40 * trainA) * 0.8
797 b = b + railg * (0.62 + 0.25 * trainA) * 0.8
799 # three drip rings in the near water
800 rp1 = len((su - 0.30) * 1.1, (sv + 0.80) * 1.6)
801 rp2 = len((su + 0.42) * 1.0, (sv + 0.62) * 1.5)
802 rp3 = len((su - 0.78) * 1.1, (sv + 0.55) * 1.5)
803 ring = exp(-abs(rp1 - fract(time * 0.31 + 0.1) * 0.34) * 110.0)
804 ring = ring + exp(-abs(rp2 - fract(time * 0.23 + 0.5) * 0.28) * 120.0) * 0.8
805 ring = ring + exp(-abs(rp3 - fract(time * 0.19 + 0.8) * 0.26) * 130.0) * 0.6
806 ring = ring * (1 - smooth(0.0, 0.5, rp1)) * mf * wet * 0.14
807 r = r + ring * 0.7
808 g = g + ring * 0.85
809 b = b + ring * 1.0
811 # vending machine spill on the floor and wall
812 spill = exp(-len((uu - 0.49) * 1.45, (vv + 0.28) * 1.05) * 7.0)
813 spill = spill * (0.7 + 0.5 * tickE) * 1.4
814 r = r + spill * 0.28
815 g = g + spill * 0.17
816 b = b + spill * 0.06
818 # puddle returns a little of the sign and the machine as vertical streaks
819 streak = exp(-abs(uu - 0.47) * 26.0) * smooth(-0.36, -0.50, vv)
820 streak = streak * (0.35 + 0.65 * (0.5 + 0.5 * sin(vv * 95.0 + time * 2.6)))
821 r = r + streak * 0.9
822 g = g + streak * 0.62
823 b = b + streak * 0.26
825 # ---------------------------------------------------------------- fluorescent battens
826 # only meaningful on the ceiling, but evaluated once; the bar is a thin band
827 # in z around each fixture.
828 barz = abs(pz - tubez)
829 lbarm = (1 - smooth(0.07, 0.16, barz)) * mc
830 lbarm = lbarm * step(abs(px), 2.35) * step(2.6, pz)
831 tglow = exp(-barz * 2.4) * mc * step(abs(px), 3.2) * (0.5 + 0.5 * tfl)
832 tglow = tglow / (1.0 + pz * 0.06)
833 housing = (1 - smooth(0.14, 0.30, barz)) * mc * step(abs(px), 2.5)
834 r = r - housing * 0.02
835 g = g - housing * 0.02
836 b = b - housing * 0.02
837 r = r + lbarm * 1.55 + tglow * 0.28
838 g = g + lbarm * 1.62 + tglow * 0.31
839 b = b + lbarm * 1.55 + tglow * 0.36
841 # a second row of small downlights on the right wall? no: keep the lamps singular.
843 # ---------------------------------------------------------------- the person
844 # world (x,z) to screen at their depth
845 pz0 = 3.60
846 pxs = up + (-0.50) / pz0
847 pys = vh - HH / pz0
848 ps = 1.0 / pz0
849 ppx = (uu - pxs) / ps
850 ppy = (vv - pys) / ps
851 pmir = step(vv, pys)
852 pfy = mix(ppy, -ppy, pmir)
853 pd = fig(ppx + pmir * 0.02 * sin(ppy * 7.0 + time * 1.6), pfy)
854 pm = (1 - smooth(-0.012, 0.012, pd)) * step(0.0, ppy) * step(ppy, 2.05) * (1 - pmir)
855 pedge = exp(-abs(pd) * 70.0)
856 # coat and rim: cold from above, warm from the machine
857 fillr = 0.009
858 fillg = 0.011
859 fillb = 0.018
860 warm = smooth(-0.2, 0.7, ppx) * (0.35 + 0.65 * smooth(0.2, 1.2, ppy))
861 rimtop = smooth(0.55, 1.15, ppy) * pedge
862 # coat: a faint vertical fold and a lighter shoulder line
863 fold = exp(-abs(ppx - 0.015) * 52.0) * smooth(0.55, 1.35, ppy) * 0.020
864 shoulder = smooth(1.30, 1.42, ppy) * 0.035
865 rr2 = fillr + pedge * (0.46 + 0.85 * warm) + rimtop * 0.28 + fold + shoulder
866 gg2 = fillg + pedge * (0.50 + 0.50 * warm) + rimtop * 0.32 + fold * 0.8 + shoulder * 0.9
867 bb2 = fillb + pedge * (0.54 + 0.18 * warm) + rimtop * 0.38 + fold * 0.7 + shoulder * 0.8
868 # the beanie and the scarf catch a little of the colours around them
869 capm = smooth(1.605, 1.660, ppy) * pm
870 rr2 = rr2 + capm * (0.095 + 0.06 * warm)
871 gg2 = gg2 + capm * (0.045 + 0.02 * warm)
872 bb2 = bb2 + capm * (0.030 + 0.01 * warm)
873 scarf = exp(-abs(ppy - 1.445) * 22.0) * pm
874 rr2 = rr2 + scarf * (0.105 + 0.05 * warm)
875 gg2 = gg2 + scarf * 0.045
876 bb2 = bb2 + scarf * 0.028
877 r = mix(r, rr2, pm)
878 g = mix(g, gg2, pm)
879 b = mix(b, bb2, pm)
880 # reflection on the wet floor: the same figure, mirrored and smeared
881 prm = (1 - smooth(-0.05, 0.05, pd)) * step(-1.1, pfy) * step(pfy, 0.0)
882 prm = prm * pmir * (0.15 + 0.15 * wet) * step(-0.50, vv) * 0.55
883 r = mix(r, 0.06, prm * 0.45)
884 g = mix(g, 0.065, prm * 0.45)
885 b = mix(b, 0.08, prm * 0.45)
887 # ---------------------------------------------------------------- the far night
888 # beyond the left edge of the station: a wet city breathing out there
889 night = mb * step(xb, -5.0)
890 blink = hash(floor(xb * 1.3) + floor(yb * 2.1) * 7.7)
891 city = step(0.86, blink) * (0.5 + 0.5 * sin(time * (0.4 + blink) + blink * 9.0))
892 cityr = city * (0.40 + 0.35 * hash(floor(xb * 2.0) + 3.0))
893 cityg = city * (0.26 + 0.25 * hash(floor(xb * 2.0) + 5.0))
894 cityb = city * (0.16 + 0.20 * hash(floor(xb * 2.0) + 7.0))
895 r = mix(r, 0.008 + cityr * 0.5, night * 0.85)
896 g = mix(g, 0.010 + cityg * 0.5, night * 0.85)
897 b = mix(b, 0.020 + cityb * 0.5, night * 0.85)
899 # ---------------------------------------------------------------- grade
900 # glass tint, vignette, rain glints
901 r = r * (0.985 - rdk * 0.030) + rgli * 0.12
902 g = g * (1.000 - rdk * 0.028) + rgli * 0.135
903 b = b * (1.010 - rdk * 0.024) + rgli * 0.15
904 wash = trainA * trainA * 0.075
905 r = r + wash * 1.00
906 g = g + wash * 0.82
907 b = b + wash * 0.58
908 vg = len(su * 0.86, sv * 0.92)
909 cm = (1.0 - 0.34 * vg * vg) * (1.0 - 0.10 * smooth(29.0, 30.0, time))
910 rgb(max(r * cm, 0.0), max(g * cm, 0.0), max(b * cm, 0.0))
911 cadd(0.0010, 0.0012, 0.0026)
912}
914post {
915 su = u * 0.5
916 sv = v * 0.5
918 # gentle bloom, halation, grain and a touch of vertical smear
919 cr = tap(0, 0)
920 cg = r1
921 cb = r2
922 br = 0.0
923 bg = 0.0
924 bb = 0.0
925 s0 = tap(-2, 0)
926 br = br + s0
927 bg = bg + r1
928 bb = bb + r2
929 s0 = tap(2, 0)
930 br = br + s0
931 bg = bg + r1
932 bb = bb + r2
933 s0 = tap(0, -2)
934 br = br + s0
935 bg = bg + r1
936 bb = bb + r2
937 s0 = tap(0, 2)
938 br = br + s0
939 bg = bg + r1
940 bb = bb + r2
941 s0 = tap(-5, -3)
942 br = br + s0 * 0.6
943 bg = bg + r1 * 0.6
944 bb = bb + r2 * 0.6
945 s0 = tap(5, 3)
946 br = br + s0 * 0.6
947 bg = bg + r1 * 0.6
948 bb = bb + r2 * 0.6
949 s0 = tap(0, -7)
950 br = br + s0 * 0.45
951 bg = bg + r1 * 0.45
952 bb = bb + r2 * 0.45
953 s0 = tap(-9, 0)
954 br = br + s0 * 0.30
955 bg = bg + r1 * 0.30
956 bb = bb + r2 * 0.30
958 br = br * 0.085
959 bg = bg * 0.085
960 bb = bb * 0.085
961 r = cr + br * 0.34
962 g = cg + bg * 0.33
963 b = cb + bb * 0.35
965 # ---------------------------------------------------------------- overlays
966 # screen-space props, drawn after the analytic scene
967 up = 0.060 + 0.006 * sin(time * 0.09)
968 vh = 0.040 + 0.003 * sin(time * 0.13 + 0.4)
969 zm = 1.0 + 0.030 * smooth(0.0, 30.0, time)
970 uu = up + (su - up) / zm
971 vv = vh + (sv - vh) / zm
973 # departure board: amber dot matrix, right of centre
974 bdx = (uu - 0.215) / 0.090
975 bdy = (vv - 0.138) / 0.030
976 bin = (1 - smooth(0.94, 1.0, abs(bdx))) * (1 - smooth(0.94, 1.0, abs(bdy)))
977 bdot = step(0.42, fract(bdx * 15.0 + 0.5)) * step(0.40, fract(bdy * 4.0 + 0.5))
978 bpat = 0.35 + 0.65 * step(0.30, hash(floor(bdx * 15.0) * 3.1 + board * 7.0 + floor(bdy * 4.0)))
979 bam = bin * (0.10 + 0.90 * bdot) * bpat
980 r = r + bam * (0.85 + 0.15 * tickE)
981 g = g + bam * 0.50
982 b = b + bam * 0.10
983 bhalo = exp(-max(0.0, abs(uu - 0.215) - 0.090) * 16.0) * exp(-max(0.0, abs(vv - 0.138) - 0.030) * 16.0)
984 r = r + bhalo * 0.10
985 g = g + bhalo * 0.06
986 b = b + bhalo * 0.02
988 # platform sign: the word PLATFORM
989 szx0 = -0.181
990 szx1 = 0.337
991 szy0 = 0.210
992 szy1 = 0.308
993 sxl = (uu - szx0) / (szx1 - szx0)
994 syl = (vv - szy0) / (szy1 - szy0)
995 sinm = step(0.0, sxl) * step(sxl, 1.0) * step(0.0, syl) * step(syl, 1.0)
996 edgel = min(min(sxl, 1.0 - sxl) * (szx1 - szx0), min(syl, 1.0 - syl) * (szy1 - szy0))
997 signg = 0.6 + 0.4 * smooth(0.0, 0.006, edgel)
998 sgr = 0.008 + 0.005 * sin(syl * 9.0)
999 sgg = 0.036 + 0.008 * sin(syl * 9.0)
1000 sgb = 0.032 + 0.006 * sin(syl * 9.0)
1001 tcx = (sxl - 0.035) / 0.1090
1002 tcy = (0.850 - syl) / 0.7000
1003 ti = floor(tcx)
1004 tg = glyph(str(word, ti), fract(tcx), fract(tcy)) * step(0.0, tcx) * step(tcx, 7.99) * step(0.0, tcy) * step(tcy, 1.0)
1005 sgr = sgr + tg * 0.60
1006 sgg = sgg + tg * 0.68
1007 sgb = sgb + tg * 0.60
1008 sgr = sgr + signg * 0.05
1009 sgg = sgg + signg * 0.07
1010 sgb = sgb + signg * 0.06
1011 r = mix(r, sgr, sinm)
1012 g = mix(g, sgg, sinm)
1013 b = mix(b, sgb, sinm)
1014 halo = exp(-max(0.0, abs(uu - 0.078) - 0.26) * 14.0) * exp(-max(0.0, abs(vv - 0.259) - 0.049) * 14.0)
1015 halo = halo * 0.07 * (0.6 + 0.4 * titleA)
1016 r = r + halo * 0.6
1017 g = g + halo * 0.8
1018 b = b + halo * 0.7
1019 rodl = exp(-abs(uu + 0.135) * 380.0) * step(0.308, vv) * step(vv, 0.49)
1020 rodr = exp(-abs(uu + 0.255) * 380.0) * step(0.308, vv) * step(vv, 0.49)
1021 rods = (rodl + rodr) * 0.11 + exp(-abs(vv - 0.312) * 220.0) * step(-0.19, uu) * step(uu, 0.35) * 0.06
1022 r = r + rods
1023 g = g + rods
1024 b = b + rods
1026 # vending machine, standing at z = 3.9
1027 mz = 3.90
1028 mx0 = up + 1.18 / mz
1029 mx1 = up + 2.12 / mz
1030 my0 = vh - 1.55 / mz
1031 my1 = vh + (2.02 - 1.55) / mz
1032 mcx = (mx0 + mx1) * 0.5
1033 mcy = (my0 + my1) * 0.5
1034 mhw = (mx1 - mx0) * 0.5
1035 mhh = (my1 - my0) * 0.5
1036 mdmx = max(0.0, abs(uu - mcx) - mhw)
1037 mdmy = max(0.0, abs(vv - mcy) - mhh)
1038 mdist = len(mdmx, mdmy)
1039 mh = (1 - smooth(-0.0015, 0.0015, mdist))
1040 mlx = (uu - mx0) / (mx1 - mx0)
1041 mly = (vv - my0) / (my1 - my0)
1042 mbody = 0.020 + 0.012 * hash(floor(mly * 40.0) + 1.0)
1043 mglass = step(0.74, mly) * step(0.06, mly) * step(0.93, mly) * step(0.05, mlx) * step(mlx, 0.95)
1044 mrow = floor((mly - 0.10) / 0.16)
1045 mcol = floor((mlx - 0.10) / 0.105)
1046 mrowf = fract((mly - 0.10) / 0.16)
1047 mcolf = fract((mlx - 0.10) / 0.105)
1048 mcan = step(0.16, mcolf) * step(mcolf, 0.84) * step(0.24, mrowf) * step(mrowf, 0.76)
1049 mcan = mcan * step(0.08, mly) * step(mly, 0.70) * step(0.08, mlx) * step(mlx, 0.92)
1050 mhue = fract(0.56 + mcol * 0.13 + mrow * 0.29 + 0.02 * sin(time * 0.3))
1051 mcr = 0.35 + 0.65 * (1.0 - 2.0 * abs(fract(mhue + 0.0) - 0.5))
1052 mcg = 0.30 + 0.70 * (1.0 - 2.0 * abs(fract(mhue + 0.33) - 0.5))
1053 mcb = 0.28 + 0.72 * (1.0 - 2.0 * abs(fract(mhue + 0.67) - 0.5))
1054 mint = 0.55 + 0.30 * sin(mly * 21.0) * sin(time * 0.7)
1055 mrr = mbody
1056 mgg = mbody
1057 mbb = mbody
1058 mrr = mix(mrr, 0.30 + mcr * 0.42, mglass * 0.95)
1059 mgg = mix(mgg, 0.38 + mcg * 0.36, mglass * 0.95)
1060 mbb = mix(mbb, 0.40 + mcb * 0.32, mglass * 0.95)
1061 mrr = mrr + mcan * mcr * 0.55 * mint
1062 mgg = mgg + mcan * mcg * 0.55 * mint
1063 mbb = mbb + mcan * mcb * 0.55 * mint
1064 mrr = mrr + mcan * 0.05
1065 mgg = mgg + mcan * 0.055
1066 mbb = mbb + mcan * 0.06
1067 mhead = step(0.79, mly) * step(0.0, mlx) * step(mlx, 1.0) * step(0.06, mlx) * step(mlx, 0.94)
1068 mrr = mix(mrr, 0.74 + 0.10 * tickE, mhead * 0.95)
1069 mgg = mix(mgg, 0.86 + 0.06 * tickE, mhead * 0.95)
1070 mbb = mix(mbb, 0.82 + 0.06 * tickE, mhead * 0.95)
1071 mlog = step(0.86, mly) * step(mly, 0.93) * step(0.18, mlx) * step(mlx, 0.70) * step(0.5, fract(mlx * 9.0))
1072 mrr = mrr - mlog * 0.5
1073 mgg = mgg - mlog * 0.4
1074 mbb = mbb - mlog * 0.3
1075 mslot = step(0.80, mlx) * step(0.88, mlx) * step(0.12, mly) * step(mly, 0.44)
1076 mrr = mix(mrr, 0.05, mslot)
1077 mgg = mix(mgg, 0.05, mslot)
1078 mbb = mix(mbb, 0.05, mslot)
1079 mbtn = exp(-len((mlx - 0.845) * 18.0, (mly - 0.50) * 18.0)) * step(0.0, mlx) * step(mlx, 1.0)
1080 mrr = mrr + mbtn * 0.9
1081 mgg = mgg + mbtn * 0.4
1082 mbb = mbb + mbtn * 0.2
1083 r = mix(r, mrr, mh)
1084 g = mix(g, mgg, mh)
1085 b = mix(b, mbb, mh)
1086 mshadow = exp(-len((uu - 0.485) * 2.4, (vv + 0.380) * 4.2) * 3.2) * 0.30
1087 r = r * (1 - mshadow)
1088 g = g * (1 - mshadow)
1089 b = b * (1 - mshadow)
1090 mhalo = exp(-mdist * 16.0) * (0.55 + 0.15 * tickE)
1091 r = r + mhalo * 0.34
1092 g = g + mhalo * 0.30
1093 b = b + mhalo * 0.24
1095 # the suitcase by the figure's feet
1096 scx = up + 0.16 / 3.95
1097 scy = vh - 1.55 / 3.95
1098 scs = 1.0 / 3.95
1099 scdx = abs(uu - scx) / scs - 0.26
1100 scdy = abs(vv - scy - 0.19 * scs) / scs - 0.19
1101 scd = len(max(scdx, 0.0), max(scdy, 0.0)) + min(max(scdx, scdy), 0.0)
1102 scm = (1 - smooth(-0.01, 0.01, scd))
1103 sch = exp(-abs(scd) * 40.0)
1104 r = mix(r, 0.040 + sch * 0.22 + 0.010, scm)
1105 g = mix(g, 0.030 + sch * 0.15, scm)
1106 b = mix(b, 0.026 + sch * 0.09, scm)
1107 scl = exp(-abs(len((uu - scx) / scs, (vv - scy - 0.42 * scs) / scs) - 0.09) * 70.0) * step(0.20, vv)
1108 r = r + scl * 0.05
1109 g = g + scl * 0.045
1110 b = b + scl * 0.035
1112 # headlight: a pin of light that will not arrive
1113 hlx = up + (-0.25) / 32.0
1114 hly = vh + (1.00 - 1.55) / 32.0
1115 hd = len((uu - hlx) * 1.1, (vv - hly) * 1.5)
1116 core = exp(-hd * hd * (5200.0 - 4600.0 * trainA))
1117 glow = exp(-hd * (120.0 - 105.0 * trainA)) * (0.14 + 0.86 * trainA * trainA)
1118 flk = 0.92 + 0.08 * sin(time * 31.0) * sin(time * 3.1)
1119 r = r + core * 2.2 * flk + glow * 0.22 * trainA
1120 g = g + core * 2.0 * flk + glow * 0.18 * trainA
1121 b = b + core * 1.7 * flk + glow * 0.12 * trainA
1122 streak2 = exp(-abs(vv - hly) * 260.0) * exp(-abs(uu - hlx) * 2.4) * trainA * trainA
1123 r = r + streak2 * 0.20
1124 g = g + streak2 * 0.17
1125 b = b + streak2 * 0.11
1126 sigr = exp(-len((uu - hlx - 0.020) * 900.0, (vv - hly - 0.010) * 900.0))
1127 r = r + sigr * mix(0.9, 0.25, trainA)
1128 g = g + sigr * mix(0.08, 0.55, trainA)
1129 b = b + sigr * mix(0.04, 0.55, trainA)
1131 # contrast and a warm/cool split: cold water, warm machine light
1132 r = clamp(r * 1.04, 0.0, 2.0)
1133 g = clamp(g * 1.02, 0.0, 2.0)
1134 b = clamp(b * 1.00, 0.0, 2.0)
1135 r = mix(r, r * r * (3.0 - 2.0 * clamp(r, 0.0, 1.0)), 0.22)
1136 g = mix(g, g * g * (3.0 - 2.0 * clamp(g, 0.0, 1.0)), 0.22)
1137 b = mix(b, b * b * (3.0 - 2.0 * clamp(b, 0.0, 1.0)), 0.22)
1138 lumg = 0.30 * r + 0.59 * g + 0.11 * b
1139 shade = 1.0 - smooth(0.0, 0.28, lumg)
1140 r = r + shade * 0.004 + smooth(0.35, 0.9, lumg) * 0.012
1141 g = g + shade * 0.007 + smooth(0.35, 0.9, lumg) * 0.010
1142 b = b + shade * 0.016 + smooth(0.35, 0.9, lumg) * 0.006
1143 sat = 1.10
1144 r = lumg + (r - lumg) * sat
1145 g = lumg + (g - lumg) * sat
1146 b = lumg + (b - lumg) * sat
1147 # grain
1148 gr = (hash(x * w * 0.37 + y * h * 0.71 + frame * 9.7) - 0.5) * 0.030
1149 r = r + gr
1150 g = g + gr * 0.85
1151 b = b + gr * 0.70
1152 d = len(su, sv)
1153 r = r * (1 - 0.26 * d * d)
1154 g = g * (1 - 0.26 * d * d)
1155 b = b * (1 - 0.24 * d * d)
1156 rgb(max(r, 0.0), max(g, 0.0), max(b, 0.0))
1157}
Click a line number to link to that line.