FYR
fyr.dmt · 90 BPM · 1:04 · render pending
model-madelongunrenderedcinematicoceanraymarchstorm
MP4 unavailable Use live playback, download the source, or render locally:
./dm render demos/fyr.dmt --mp4 build/video/fyr.mp4 --wav build/audio/fyr.wav --seconds 64.00 --size 960x600 --fps 30
notes
A small boat rides a storm toward a lighthouse and reaches it at first light.
| music | 6/8 sea tune in D minor at 90 BPM: fog signal and bell buoy, low whistle over a lilting bass, then reed, brass and galloping drums under thunder, and the same tune in D major at dawn; the surf is one held noise voice automated from the timeline |
|---|---|
| visual | one continuous shot from the bow: heightfield-marched swell with Fresnel sky reflection and foam, a raymarched banded lighthouse on a skerry, an analytic rotating volumetric beam that whites out the lens on every second bar, thunder-triggered lightning, rain lit only where light crosses it, moon to sunrise; scale=2 dither=1 |
| file | fyr.dmt |
|---|---|
| duration | 1:04 |
| video | not rendered yet |
| song | 90 BPM · speed 6 · rpb 6 · 8 channels |
| loop | 0 |
| render | scale 2 · dither on · master 0.45 |
| uniforms | wS stK covK dawnK lampK titleK camY camRoll camPitch boatZ Lx Ly Lz Ld bdx bdz glare flashK boltK boltU fogD fogR fogG fogB ambR ambG ambB rainK sunX sunY sunZ |
| model | Claude Fable 5.2 |
| author | Claude |
| tags | model-madelongunrenderedcinematicoceanraymarchstorm |
| source | 906 lines · 27 KB · download |
anatomy
20VM programs
8patterns
0palettes
28timeline events
2text / sample / texture
906source lines
11inst
5chan
1master
1frame
1pixel
1post
3fn
line composition
pattern 46%pixel 29%inst 8%fn 5%frame 4%post 3%chan 3%timeline 2%master 1%text 0%title 0%song 0%order 0%pan 0%uniform 0%
play order
01234567
order list · 8 entries
timeline
| at | event | value | source | |
|---|---|---|---|---|
| 0:00 | stormv | 0.08 | L21 | |
| 0:00 | covv | 0.28 | L21 | |
| 0:00 | dawnv | 0 | L21 | |
| 0:00 | lampv | 1 | L21 | |
| 0:00 | titlev | 0 | L21 | |
| 0:11 | stormv | 0.22 | L22 | |
| 0:11 | covv | 0.45 | L22 | |
| 0:16 | stormv | 0.55 | L23 | |
| 0:16 | covv | 0.80 | L23 | |
| 0:21 | stormv | 1.00 | L24 | |
| 0:21 | covv | 1.00 | L24 | |
| 0:31 | stormv | 1.00 | L25 | |
| 0:31 | covv | 1.00 | L25 | |
| 0:32 | stormv | 0.42 | L26 | |
| 0:32 | covv | 0.62 | L26 | |
| 0:32 | dawnv | 0 | L26 | |
| 0:37 | stormv | 0.14 | L27 | |
| 0:37 | covv | 0.36 | L27 | |
| 0:37 | dawnv | 0.55 | L27 | |
| 0:40 | titlev | 0 | L28 | |
| 0:40 | lampv | 1 | L29 | |
| 0:41 | lampv | 0 | L30 | |
| 0:41 | titlev | 1 | L31 | |
| 0:43 | stormv | 0.06 | L32 | |
| 0:43 | covv | 0.30 | L32 | |
| 0:43 | dawnv | 1 | L32 | |
| 0:43 | lampv | 0 | L32 | |
| 0:43 | titlev | 1 | L32 |
Event times are derived from the order list, pattern lengths, BPM and RPB.
resources
| kind | name | info | value |
|---|---|---|---|
| text | ttl | 3 | FYR |
| text | cap | 25 | A LIGHT KEPT FOR ONE BOAT |
source
1# @author Claude
2# @model Claude Fable 5.2
3# @description A small boat rides a storm toward a lighthouse and reaches it at first light.
4# @music 6/8 sea tune in D minor at 90 BPM: fog signal and bell buoy, low whistle over a lilting bass, then reed, brass and galloping drums under thunder, and the same tune in D major at dawn; the surf is one held noise voice automated from the timeline
5# @visual one continuous shot from the bow: heightfield-marched swell with Fresnel sky reflection and foam, a raymarched banded lighthouse on a skerry, an analytic rotating volumetric beam that whites out the lens on every second bar, thunder-triggered lightning, rain lit only where light crosses it, moon to sunrise; scale=2 dither=1
6# @tags raymarch, ocean, storm, cinematic
7# @duration 64
8# fyr.dmt - "fyr" is Norwegian for lighthouse. 90 BPM, 6/8, rpb=6: one beat = one
9# second, one bar = 12 rows = 2 s, eight 4-bar patterns = 64 s.
10# The two-sided beam turns once every 8 s, so it crosses the camera on rows 0
11# and 24 of every pattern; the drum marks each pass.
12title FYR
13song bpm=90 speed=6 rpb=6 channels=8 loop=0 volume=0.45 scale=2 dither=1
14order 0 1 2 3 4 5 6 7
15pan 0.50 0.56 0.50 0.46 0.42 0.60 0.50 0.50
17text ttl "FYR"
18text cap "A LIGHT KEPT FOR ONE BOAT"
20timeline {
21 0:00 stormv=0.08 covv=0.28 dawnv=0 lampv=1 titlev=0
22 2:00 stormv=0.22 covv=0.45
23 3:00 stormv=0.55 covv=0.80
24 4:00 stormv=1.00 covv=1.00
25 5:36 stormv=1.00 covv=1.00
26 6:00 stormv=0.42 covv=0.62 dawnv=0
27 7:00 stormv=0.14 covv=0.36 dawnv=0.55
28 7:20 titlev=0
29 7:24 lampv=1
30 7:30 lampv=0
31 7:34 titlev=1
32 7:47 stormv=0.06 covv=0.30 dawnv=1 lampv=0 titlev=1
33}
35# ------------------------------------------------------------------ instruments
36inst drum {
37 f = 46 + 130 * exp(-t * 16)
38 $p = $p + f / sr
39 body = sin($p * tau) * exp(-t * 3.4)
40 skin = lp(noise(), 600) * exp(-t * 24)
41 out(dist((body * 1.1 + skin * 0.6) * 1.3, 1.2) * 0.62)
42}
43inst brush {
44 e = exp(-t * (16 + 26 * (1 - vel)))
45 n = svf(noise(), 2100, 0.45)
46 out((r2 * 0.8 + hp(noise(), 5200) * 0.35) * e * 2.6)
47}
48inst bass {
49 e = env(0.02, 0.30, 0.70, 0.25)
50 s = sin(ph * tau) * 0.9 + bsaw(ph, freq) * 0.28
51 s = svf(s, 170 + 520 * e, 0.25)
52 out(dist(s * e, 1.2) * 0.50)
53}
54# p0 picks the third: S00 minor, SFF major
55inst pad nna=continue {
56 e = env(0.55, 0.8, 0.85, 1.7)
57 third = 2 ^ ((3 + step(0.5, p0)) / 12)
58 a = usaw(freq, 0.15) + usaw(freq * third, 0.15) + usaw(freq * 1.4983, 0.15)
59 s = svf(a, 420 + 1700 * evtl(stormv) + 280 * e, 0.14)
60 out(s * e * 0.19)
61}
62inst whistle {
63 e = env(0.06, 0.2, 0.86, 0.32)
64 vib = 0.22 * sin(t * 5.4 * tau) * smooth(0.12, 0.5, t)
65 tone = sin(ph * tau + vib) + sin(ph * tau * 2 + vib) * 0.14 + sin(ph * tau * 3) * 0.05
66 br = svf(noise(), freq * 2, 0.6)
67 out((tone * 0.5 + r2 * 0.05 * (1 + 4 * exp(-t * 22))) * e * 0.34)
68}
69inst reed {
70 e = env(0.035, 0.15, 0.82, 0.22)
71 $q = fract($q + freq * 1.007 / sr)
72 a = bsqr(ph, 0.5, freq) + bsqr($q, 0.42, freq) * 0.8
73 s = svf(a, 800 + 1900 * e + 2200 * p0, 0.22)
74 out(s * e * (1 + 0.07 * sin(t * 5.2 * tau)) * 0.15)
75}
76inst horn nna=continue {
77 e = env(0.22, 0.4, 0.8, 0.9)
78 $q = fract($q + freq * 0.996 / sr)
79 a = bsaw(ph, freq) + bsaw($q, freq) * 0.8
80 s = svf(a, 200 + 600 * e + 1500 * p0, 0.3)
81 out(dist(s * e * 1.2, 1.5) * 0.30)
82}
83inst bell nna=continue {
84 e = exp(-t * 1.5)
85 m = sin(ph * tau * 3.51) * 1.5 * exp(-t * 3)
86 out((sin(ph * tau + m) + sin(ph * tau * 2.76) * 0.3 * exp(-t * 4) + sin(ph * tau * 5.4) * 0.12 * exp(-t * 8)) * e * 0.22)
87}
88# held for the whole song; the timeline plays it. One wash per bar.
89inst sea {
90 st = evtl(stormv)
91 sw = 0.5 + 0.5 * sin((beat * 0.5 - 0.22) * tau)
92 wash = svf(noise(), 240 + 380 * st + 900 * sw * sw, 0.45)
93 ww = svf(noise(), 520 + 380 * sin(time * 0.37) + 900 * st, 0.78)
94 wind = r2
95 rain = hp(noise(), 4200) * smooth(0.4, 0.9, st)
96 out((wash * (0.30 + 0.70 * sw) * (0.9 + 0.9 * st) + wind * (0.10 + 0.40 * st) + rain * 0.30) * smooth(0, 3, time) * 0.42)
97}
98inst thunder nna=continue {
99 crack = hp(noise(), 1500) * exp(-t * 8) * 0.5
100 roll = lp(lp(noise(), 120), 90) * exp(-t * 0.85) * (0.6 + 0.4 * sin(t * 13 + 3 * sin(t * 2.1))) * smooth(0, 0.12, t)
101 out(dist(crack + roll * 9, 1.6) * 0.22)
102}
103inst cym {
104 out((hp(noise(), 6500) + sin(tau * 5310 * t) * 0.2) * exp(-t * 2.4) * 0.20)
105}
107chan 0 {
108 w = verb(x, 0.72, 0.6)
109 out(x + w * 0.16)
110}
111chan 3 {
112 w = verb(x, 0.85, 0.5)
113 out(x * 0.75 + w * 0.45)
114}
115chan 4 {
116 d = dly(x, 0.5, 0.30)
117 w = verb(x, 0.84, 0.4)
118 out(x * 0.85 + d * 0.22 + w * 0.42)
119}
120chan 5 {
121 d = dly(x, 0.3333, 0.34)
122 w = verb(x, 0.88, 0.45)
123 out(x * 0.8 + d * 0.18 + w * 0.5)
124}
125chan 7 {
126 w = verb(x, 0.93, 0.3)
127 out(x * 0.8 + w * 0.7)
128}
129master {
130 vl = verb(l + r * 0.2, 0.84, 0.35)
131 vr = verb(r + l * 0.2, 0.84, 0.35)
132 out(dist(l * 0.95 + vl * 0.15, 1.05), dist(r * 0.95 + vr * 0.15, 1.05))
133}
135# ------------------------------------------------------------------ score
136# ch0 drum | ch1 brush/cym | ch2 bass | ch3 pad | ch4 whistle/reed | ch5 horn/bell | ch6 sea | ch7 thunder
137pattern 0 rows=48 {
138 00: C-2 1 24 | . | . | . | . | D-2 7 24 S20 | C-4 9 40
139 01: .
140 02: .
141 03: .
142 04: .
143 05: .
144 06: .
145 07: .
146 08: .
147 09: .
148 10: .
149 11: .
150 12: .
151 13: .
152 14: .
153 15: .
154 16: . | . | . | . | . | off
155 17: .
156 18: .
157 19: .
158 20: . | . | . | . | A-5 8 12
159 21: .
160 22: .
161 23: .
162 24: C-2 1 18 | . | . | D-3 4 10 S00 | . | A-1 7 20
163 25: .
164 26: .
165 27: .
166 28: .
167 29: .
168 30: .
169 31: .
170 32: .
171 33: . | . | . | . | A-5 8 0C
172 34: .
173 35: .
174 36: .
175 37: .
176 38: .
177 39: .
178 40: . | . | . | . | . | off
179 41: .
180 42: .
181 43: .
182 44: .
183 45: . | . | . | . | A-5 8 0E
184 46: .
185 47: .
186}
187pattern 1 rows=48 {
188 00: C-2 1 22 | . | D-2 3 24 | D-3 4 18 S00 | A-4 5 3A
189 01: .
190 02: .
191 03: .
192 04: .
193 05: .
194 06: . | . | A-2 3 1E | . | D-5 5 3A
195 07: .
196 08: .
197 09: .
198 10: . | . | . | . | E-5 5 3A
199 11: .
200 12: . | . | A#1 3 24 | A#2 4 18 SFF | F-5 5 3A
201 13: .
202 14: . | . | . | . | . | F-5 8 0C
203 15: .
204 16: .
205 17: .
206 18: . | . | F-2 3 1E | . | E-5 5 3A
207 19: .
208 20: . | . | . | . | D-5 5 3A
209 21: .
210 22: . | . | . | . | A#4 5 3A
211 23: .
212 24: C-2 1 18 | . | F-2 3 24 | F-3 4 18 SFF | C-5 5 3A
213 25: .
214 26: .
215 27: .
216 28: . | . | . | . | A-4 5 3A
217 29: .
218 30: . | . | C-2 3 1E | . | F-4 5 3A
219 31: .
220 32: .
221 33: .
222 34: . | . | . | . | A-4 5 3A
223 35: .
224 36: . | . | C-2 3 24 | C-3 4 18 SFF | G-4 5 3A
225 37: .
226 38: . | . | . | . | . | G-5 8 0C
227 39: .
228 40: .
229 41: .
230 42: . | . | G-2 3 1E | . | E-4 5 3A
231 43: .
232 44: .
233 45: .
234 46: . | . | . | . | G-4 5 3A
235 47: .
236}
237pattern 2 rows=48 {
238 00: C-2 1 24 | . | D-2 3 26 | D-3 4 1C S00 | A-4 5 3C | A-3 7 0B S30
239 01: .
240 02: .
241 03: .
242 04: .
243 05: .
244 06: . | C-5 2 0E | A-2 3 20 | . | D-5 5 3C
245 07: .
246 08: .
247 09: .
248 10: . | . | . | . | E-5 5 3C
249 11: .
250 12: C-2 1 16 | . | A#1 3 26 | A#2 4 1C SFF | F-5 5 3C | A#3 7 0B
251 13: .
252 14: .
253 15: .
254 16: .
255 17: .
256 18: . | C-5 2 0E | F-2 3 20 | . | G-5 5 3C
257 19: .
258 20: . | . | . | . | F-5 5 3C
259 21: .
260 22: . | . | . | . | D-5 5 3C
261 23: .
262 24: C-2 1 24 | . | G-1 3 26 | G-2 4 1C S00 | A#4 5 3C
263 25: .
264 26: .
265 27: .
266 28: . | . | . | . | D-5 5 3C
267 29: .
268 30: . | C-5 2 0E | D-2 3 20 | . | G-5 5 3C | G-3 7 0B
269 31: .
270 32: .
271 33: .
272 34: .
273 35: .
274 36: C-2 1 16 | . | A-1 3 26 | A-2 4 1C SFF | E-5 5 3C | A-3 7 0B
275 37: .
276 38: .
277 39: .
278 40: .
279 41: .
280 42: . | C-5 2 0E | E-2 3 20 | . | C#5 5 3C | C#4 7 0B
281 43: .
282 44: .
283 45: .
284 46: . | . | . | . | E-5 5 3C
285 47: .
286}
287pattern 3 rows=48 {
288 00: C-2 1 2C | . | D-2 3 2A | D-3 4 20 S00 | . | D-3 7 20 S60
289 01: .
290 02: .
291 03: .
292 04: . | C-5 2 12 | D-2 3 20
293 05: .
294 06: C-2 1 22 | . | D-2 3 26
295 07: .
296 08: .
297 09: .
298 10: C-2 1 16 | C-5 2 16 | D-2 3 20
299 11: .
300 12: C-2 1 2C | . | C-2 3 2A | C-3 4 20 SFF | . | E-3 7 20
301 13: .
302 14: .
303 15: .
304 16: . | C-5 2 12 | C-2 3 20
305 17: .
306 18: C-2 1 22 | . | C-2 3 26
307 19: .
308 20: .
309 21: .
310 22: C-2 1 16 | C-5 2 16 | C-2 3 20
311 23: .
312 24: C-2 1 2C | . | A#1 3 2A | A#2 4 20 SFF | D-5 6 2A S40 | F-3 7 20
313 25: .
314 26: .
315 27: .
316 28: . | C-5 2 12 | A#1 3 20 | . | F-5 6 2A
317 29: .
318 30: C-2 1 22 | . | A#1 3 26 | . | A#5 6 2A | . | . | A-2 10 1C
319 31: .
320 32: .
321 33: .
322 34: C-2 1 16 | C-5 2 16 | A#1 3 20
323 35: .
324 36: C-2 1 18 | . | A-1 3 2A | A-2 4 20 SFF | A-5 6 2A | A-3 7 20
325 37: .
326 38: C-2 1 1C
327 39: .
328 40: C-2 1 20 | . | A-1 3 20
329 41: .
330 42: C-2 1 24 | . | A-1 3 26 | . | ... . .. 443
331 43: C-2 1 28
332 44: C-2 1 2C
333 45: C-2 1 30
334 46: C-2 1 34 | . | A-1 3 20
335 47: C-2 1 38
336}
337pattern 4 rows=48 {
338 00: C-2 1 38 | C-6 11 26 | D-2 3 30 | D-3 4 26 S00 | D-5 6 32 S90 | D-3 7 26 SA0
339 01: .
340 02: . | . | . | . | . | . | . | E-3 10 3C
341 03: .
342 04: . | C-5 2 16 | D-2 3 26
343 05: .
344 06: C-2 1 2C | . | D-2 3 2C | . | A-5 6 32 | F-3 7 26
345 07: .
346 08: . | C-5 2 0E
347 09: .
348 10: C-2 1 20 | C-5 2 1A | D-2 3 26
349 11: .
350 12: C-2 1 38 | . | C-2 3 30 | C-3 4 26 SFF | G-5 6 32 | E-3 7 26
351 13: .
352 14: . | C-5 2 0E
353 15: .
354 16: . | C-5 2 16 | C-2 3 26
355 17: .
356 18: C-2 1 2C | . | C-2 3 2C | . | E-5 6 32 | G-3 7 26
357 19: .
358 20: . | C-5 2 0E
359 21: .
360 22: C-2 1 20 | C-5 2 1A | C-2 3 26 | . | C-5 6 32
361 23: .
362 24: C-2 1 38 | . | A#1 3 30 | A#2 4 26 SFF | F-5 6 32 | D-3 7 26
363 25: .
364 26: . | C-5 2 0E
365 27: .
366 28: . | C-5 2 16 | A#1 3 26
367 29: .
368 30: C-2 1 2C | . | A#1 3 2C | . | D-5 6 32 | F-3 7 26 | . | G-2 10 2C
369 31: .
370 32: . | C-5 2 0E
371 33: .
372 34: C-2 1 20 | C-5 2 1A | A#1 3 26 | . | A#4 6 32
373 35: .
374 36: C-2 1 38 | . | A-1 3 30 | A-2 4 26 SFF | E-5 6 32 | E-3 7 26
375 37: .
376 38: . | C-5 2 0E
377 39: .
378 40: . | C-5 2 16 | A-1 3 26
379 41: .
380 42: C-2 1 2C | . | A-1 3 2C | . | C#5 6 32 | A-3 7 26
381 43: .
382 44: . | C-5 2 0E
383 45: .
384 46: C-2 1 20 | C-5 2 1A | A-1 3 26 | . | A-4 6 32
385 47: .
386}
387pattern 5 rows=48 {
388 00: C-2 1 38 | C-6 11 26 | D-2 3 30 | D-3 4 28 S00 | F-5 6 36 SC0 | D-3 7 2A SD0
389 01: .
390 02: .
391 03: .
392 04: . | C-5 2 16 | D-2 3 26 | . | A-5 6 36
393 05: .
394 06: C-2 1 2C | . | D-2 3 2C | . | D-6 6 36 | A-3 7 2A
395 07: .
396 08: . | C-5 2 0E
397 09: .
398 10: C-2 1 20 | C-5 2 1A | D-2 3 26
399 11: .
400 12: C-2 1 38 | . | C-2 3 30 | C-3 4 28 SFF | C-6 6 36 | G-3 7 2A | . | A-2 10 30
401 13: .
402 14: . | C-5 2 0E
403 15: .
404 16: . | C-5 2 16 | C-2 3 26
405 17: .
406 18: C-2 1 2C | . | C-2 3 2C | . | G-5 6 36 | E-3 7 2A
407 19: .
408 20: . | C-5 2 0E
409 21: .
410 22: C-2 1 20 | C-5 2 1A | C-2 3 26 | . | E-5 6 36
411 23: .
412 24: C-2 1 38 | . | A#1 3 30 | A#2 4 28 SFF | A#5 6 36 | F-3 7 2A
413 25: .
414 26: . | C-5 2 0E
415 27: .
416 28: . | C-5 2 16 | A#1 3 26
417 29: .
418 30: C-2 1 2C | . | A#1 3 2C | . | F-5 6 36 | A#3 7 2A
419 31: .
420 32: . | C-5 2 0E
421 33: .
422 34: C-2 1 20 | C-5 2 1A | A#1 3 26 | . | D-5 6 36
423 35: .
424 36: C-2 1 1C | . | A-1 3 30 | A-2 4 28 SFF | A-5 6 36 | A-3 7 2A | . | F-3 10 40
425 37: .
426 38: C-2 1 20 | C-5 2 0E
427 39: .
428 40: C-2 1 24 | C-5 2 16 | A-1 3 26
429 41: C-2 1 28
430 42: C-2 1 2C | . | A-1 3 2C | . | C#6 6 36 | E-3 7 2A
431 43: C-2 1 30
432 44: C-2 1 34 | C-5 2 0E | . | . | ... . .. 453
433 45: C-2 1 38
434 46: C-2 1 3C | C-5 2 1A | A-1 3 26
435 47: C-2 1 40 | . | off | off | off | off
436}
437pattern 6 rows=48 {
438 00: C-2 1 1C | . | D-2 3 1E | D-3 4 16 SFF | A-5 5 36
439 01: .
440 02: . | . | . | . | . | D-5 8 14
441 03: .
442 04: .
443 05: .
444 06: . | . | . | . | D-6 5 36
445 07: .
446 08: .
447 09: .
448 10: . | . | . | . | E-6 5 36
449 11: .
450 12: . | . | G-1 3 1E | G-2 4 16 SFF | F#6 5 36
451 13: .
452 14: .
453 15: .
454 16: .
455 17: .
456 18: . | . | . | . | E-6 5 36
457 19: .
458 20: . | . | . | . | D-6 5 36 | . | . | C-3 10 0C
459 21: .
460 22: . | . | . | . | B-5 5 36
461 23: .
462 24: C-2 1 12 | . | B-1 3 1E | B-2 4 16 S00 | D-6 5 36
463 25: .
464 26: . | . | . | . | . | F#5 8 12
465 27: .
466 28: . | . | . | . | B-5 5 36
467 29: .
468 30: . | . | . | . | F#5 5 36
469 31: .
470 32: .
471 33: .
472 34: . | . | . | . | B-5 5 36
473 35: .
474 36: . | . | A-1 3 1E | A-2 4 16 SFF | A-5 5 36
475 37: .
476 38: .
477 39: .
478 40: .
479 41: .
480 42: . | . | . | . | E-5 5 36
481 43: .
482 44: .
483 45: .
484 46: . | . | . | . | A-5 5 36
485 47: .
486}
487pattern 7 rows=48 {
488 00: C-2 1 1C | . | D-2 3 20 | D-3 4 1A SFF | A-5 5 36
489 01: .
490 02: .
491 03: .
492 04: .
493 05: .
494 06: . | . | . | . | D-6 5 36
495 07: .
496 08: .
497 09: .
498 10: . | . | . | . | E-6 5 36
499 11: .
500 12: . | . | G-1 3 20 | G-2 4 1A SFF | F#6 5 36
501 13: .
502 14: .
503 15: .
504 16: .
505 17: .
506 18: . | . | . | . | E-6 5 36
507 19: .
508 20: .
509 21: .
510 22: .
511 23: .
512 24: C-2 1 16 | . | D-2 3 22 | D-3 4 1A SFF | D-6 5 36
513 25: .
514 26: . | . | . | . | . | D-5 8 14
515 27: .
516 28: .
517 29: .
518 30: . | . | . | . | ... . .. 432 | A-5 8 14
519 31: .
520 32: .
521 33: .
522 34: .
523 35: .
524 36: . | . | . | . | . | D-6 8 14
525 37: .
526 38: .
527 39: .
528 40: .
529 41: .
530 42: . | . | . | . | . | F#6 8 14
531 43: .
532 44: . | . | off | off | off
533 45: .
534 46: .
535 47: .
536}
538# ------------------------------------------------------------------ visuals
539# World: metres, y up, +z toward the lighthouse. Everything in the pixel
540# program is relative to the camera, which sits on the boat at (0, camY, boatZ).
541uniform wS stK covK dawnK lampK titleK camY camRoll camPitch boatZ Lx Ly Lz Ld bdx bdz glare flashK boltK boltU fogD fogR fogG fogB ambR ambG ambB rainK sunX sunY sunZ
543# four swells running toward the camera; a*a sharpens the crests
544fn swell(px, pz) {
545 wa = sin(px * 0.031 + pz * 0.150 + t * 1.22)
546 wb = sin(pz * 0.262 - px * 0.085 + t * 1.64 + 1.3)
547 wc = sin(px * 0.36 + pz * 0.42 + t * 2.3 + 4.0)
548 wd = sin(pz * 0.83 - px * 0.52 + t * 3.1)
549 return wS * (1.25 * (wa + 0.35 * wa * wa) + 0.62 * (wb + 0.3 * wb * wb) + 0.26 * wc + 0.11 * wd)
550}
552# sky for a direction, left in the accumulator: gradient, sun, moon, stars, cloud deck
553fn sky(ax, ay, az, oct) {
554 yy = max(ay, 0)
555 hz = (1 - yy) ^ 6
556 sd = max(ax * sunX + ay * sunY + az * sunZ, 0)
557 sg = dawnK * (sd ^ 5 * 0.30 + sd ^ 48 * 0.55 + sd ^ 1500 * 2.5)
558 cr = mix(mix(0.008, 0.028, hz), mix(0.06, 0.92, hz ^ 0.8), dawnK) + sg
559 cg = mix(mix(0.014, 0.046, hz), mix(0.13, 0.50, hz), dawnK) + sg * 0.62
560 cb = mix(mix(0.036, 0.080, hz), mix(0.30, 0.34, hz), dawnK) + sg * 0.30
561 ci = 1.4 / (yy + 0.14)
562 cc = fbm(ax * ci + t * 0.03 + 3, az * ci + t * 0.05 + boatZ * 0.004, oct)
563 cl = smooth(0.78 - 0.55 * covK, 1.02 - 0.55 * covK, cc) * smooth(-0.01, 0.10, ay) * 0.96
564 open = (1 - cl) ^ 3
565 sq = 70 / (yy + 0.35)
566 sh = hash(floor(ax * sq) * 12.9898 + floor(az * sq) * 78.233)
567 sfx = fract(ax * sq) - 0.5
568 sfz = fract(az * sq) - 0.5
569 st = step(0.982, sh) * (1 - dawnK) * smooth(0.02, 0.2, ay) * (0.45 + 0.55 * sin(t * 3 + sh * 90)) * exp(-(sfx * sfx + sfz * sfz) * 30) * open
570 md = max(ay * 0.292 + az * 0.885 - ax * 0.363, 0)
571 mo = (smooth(0.99962, 0.99976, md) * 0.9 * open + md ^ 400 * 0.22 * (0.25 + 0.75 * open) + md ^ 30 * 0.05) * (1 - 0.9 * dawnK)
572 cr += st + mo * 0.90
573 cg += st + mo * 0.95
574 cb += st * 1.1 + mo
575 fl = flashK * (0.10 + 1.1 * exp(-abs(ax - boltU * 0.42) * 5)) * (0.2 + cc * cc * 2.2)
576 ml = md ^ 6 * (1 - dawnK)
577 kr = 0.014 + (0.05 + 0.05 * covK) * cc + ml * 0.06 + fl * 0.75 + dawnK * (0.20 + 0.75 * hz * (0.5 + sd ^ 3))
578 kg = 0.019 + (0.065 + 0.06 * covK) * cc + ml * 0.07 + fl * 0.80 + dawnK * (0.17 + 0.33 * hz)
579 kb = 0.030 + (0.085 + 0.07 * covK) * cc + ml * 0.08 + fl + dawnK * (0.22 + 0.22 * hz)
580 rgb(mix(cr, kr, cl), mix(cg, kg, cl), mix(cb, kb, cl))
581}
583# lighthouse and skerry, q relative to the tower foot at sea level
584fn lh(qx, qy, qz) {
585 rr = len(qx, qz)
586 ek = sqrt(qx * qx / 676 + (qy + 1) * (qy + 1) / 72 + qz * qz / 400)
587 drock = (ek - 1) * 8.5 + (fbm(qx * 0.18 + 7, qz * 0.18 + qy * 0.25, 3) - 0.5) * 5
588 dtow = max(rr - 4.3 + (qy - 6) * 0.055, abs(qy - 19) - 13)
589 dgal = max(rr - 4.5, abs(qy - 32.3) - 0.35)
590 dlan = max(rr - 2.3, abs(qy - 34.6) - 2.0)
591 dcap = max(rr - (39.6 - qy) * 0.95, 36.6 - qy) * 0.7
592 return min(min(drock * 0.55, dtow), min(min(dgal, dlan), dcap))
593}
595frame {
596 stK = evtl(stormv)
597 covK = evtl(covv)
598 dawnK = evtl(dawnv)
599 lampK = evtl(lampv)
600 titleK = evtl(titlev)
601 wS = 0.22 + 1.45 * stK
602 boatZ = 170 * (0.55 * t / 64 + 0.45 * smooth(0, 64, t))
603 Lx = 15
604 Lz = 270 - boatZ
605 camY = 2.7 + 0.85 * swell(0, boatZ)
606 camPitch = (swell(0, boatZ + 4) - swell(0, boatZ - 4)) * 0.075
607 camRoll = (swell(4, boatZ) - swell(-4, boatZ)) * 0.09 + 0.01 * sin(t * 0.7)
608 Ly = 34.6 - camY
609 Ld = sqrt(Lx * Lx + Ly * Ly + Lz * Lz)
610 th = atan2(-Lz, -Lx) + pi * t / 4
611 bdx = cos(th)
612 bdz = sin(th)
613 al = abs(bdx * Lx + bdz * Lz) / len(Lx, Lz)
614 glare = exp(-(1 - al) * 110) * lampK
615 tt = trig(7)
616 flashK = exp(-tt * 4.5) * (0.6 + 0.4 * sin(tt * 75)) * vel(7) * step(0.25, vel(7)) * step(tt, 4) * 1.4
617 boltK = step(tt, 0.17) * step(0.25, vel(7)) * (0.5 + 0.5 * sin(tt * 110))
618 boltU = (note(7) - 48) * 0.13
619 fogD = 0.0012 + 0.0052 * stK
620 fogR = mix(0.022 + 0.030 * stK, 0.60, dawnK) + flashK * 0.09
621 fogG = mix(0.034 + 0.036 * stK, 0.42, dawnK) + flashK * 0.10
622 fogB = mix(0.058 + 0.042 * stK, 0.37, dawnK) + flashK * 0.13
623 ambR = 0.045 + flashK * 0.55 + dawnK * 0.55
624 ambG = 0.060 + flashK * 0.60 + dawnK * 0.47
625 ambB = 0.090 + flashK * 0.72 + dawnK * 0.45
626 rainK = smooth(0.4, 0.85, stK)
627 el = 0.11 * dawnK - 0.07
628 sunX = sin(-0.40) * cos(el)
629 sunY = sin(el)
630 sunZ = cos(-0.40) * cos(el)
631}
633pixel {
634 rgb(0, 0, 0)
635 if (abs(v) < 0.835) {
636 dx = rot(u, v, camRoll)
637 dy = r1 + 0.20 + camPitch
638 dz = 2.2
639 il = 1 / sqrt(dx * dx + dy * dy + dz * dz)
640 dx *= il
641 dy *= il
642 dz *= il
643 depth = 4000
644 seaK = 0
645 cR = 0
646 cG = 0
647 cB = 0
649 # ---------- sea: relaxed heightfield march, then shade
650 if (dy < 0.035) {
651 sS = 0.5
652 hg = 1
653 mden = max(-dy, 0) + 0.03 + 0.12 * wS
654 repeat i 20 {
655 hg = camY + dy * sS - swell(dx * sS, boatZ + dz * sS)
656 sS = max(sS + clamp(hg / mden, -1 - sS * 0.1, 5 + sS * 0.4), 0.5)
657 }
658 hg = camY + dy * sS - swell(dx * sS, boatZ + dz * sS)
659 if (dy < -0.004 || hg < 0.3 + sS * 0.012) {
660 seaK = 1
661 depth = sS
662 wx = dx * sS
663 wz = dz * sS
664 gz = boatZ + wz
665 eps = 0.2 + sS * 0.015
666 h0 = swell(wx, gz)
667 nx = h0 - swell(wx + eps, gz)
668 nz = h0 - swell(wx, gz + eps)
669 ck = eps * (0.25 + 0.3 * stK) / (1 + sS * 0.03)
670 hf = 5.5 / (1 + sS * sS * 0.002)
671 c0 = fbm(wx * 0.8, gz * 0.8 + t * 0.9, 3)
672 nx += ck * (sin(wx * 2.1 + gz * 1.3 + t * 3.1) + hf * (c0 - fbm(wx * 0.8 + 0.3, gz * 0.8 + t * 0.9, 3)))
673 nz += ck * (sin(gz * 2.4 - wx * 1.1 + t * 2.7) + hf * (c0 - fbm(wx * 0.8, gz * 0.8 + 0.3 + t * 0.9, 3)))
674 nl = 1 / sqrt(nx * nx + eps * eps + nz * nz)
675 nx *= nl
676 ny = eps * nl
677 nz *= nl
678 dn = dx * nx + dy * ny + dz * nz
679 rx = dx - 2 * dn * nx
680 ry = abs(dy - 2 * dn * ny) + 0.01
681 rz = dz - 2 * dn * nz
682 sky(rx, ry, rz, 2)
683 fre = 0.03 + 0.97 * (1 - clamp(-dn, 0, 1)) ^ 5
684 crest = clamp(h0 / (wS * 2.2) * 0.5 + 0.5, 0, 1)
685 # the lamp on the water: beam footprint and a glitter path
686 lvx = Lx - wx
687 lvy = 34.6 - camY - dy * sS
688 lvz = Lz - wz
689 ld = sqrt(lvx * lvx + lvy * lvy + lvz * lvz)
690 hd = len(lvx, lvz) + 0.001
691 bm = exp(-(1 - abs(lvx * bdx + lvz * bdz) / hd) * 420) * smooth(8, 30, hd)
692 lit = lampK * bm * 500 / (ld * ld * 0.2 + 900) * exp(-fogD * ld)
693 spc = max((rx * lvx + ry * lvy + rz * lvz) / ld, 0)
694 sp = lampK * (spc ^ 60 * 0.5 + spc ^ 600 * 3) * (0.35 + 1.5 * bm + 2 * glare) * 90 / (ld + 90) * exp(-fogD * ld * 1.5) * (1 - 0.7 * stK)
695 # foam on steep crests and where the swell meets the skerry
696 fo = smooth(0.66, 1.0, crest + (fbm(wx * 0.16 + 11, gz * 0.16 + t * 0.30, 2) - 0.5) * 0.7) * smooth(0.20, 0.80, stK)
697 fo = fo * mix(1, 0.45 + 0.9 * fbm(wx * 1.3, gz * 1.3 + t * 0.6, 2), 1 / (1 + sS * 0.04))
698 rk = len((wx - Lx) / 27, (wz - Lz) / 21)
699 fo = max(fo, exp(-abs(rk - 1.0) * 7) * smooth(0.25, 0.7, fbm(wx * 0.4, gz * 0.4 - t * 0.9, 2) + 0.25 * stK))
700 fo = fo * 0.75
701 dk = stK * crest * crest
702 cR = mix(mix(0.004 + 0.010 * crest + dawnK * 0.03 + dk * 0.012, cget(0), fre) + sp + lit * 0.03, (ambR + lit) * 0.85, fo)
703 cG = mix(mix(0.016 + 0.040 * crest + dawnK * 0.07 + dk * 0.045, cget(1), fre) + sp * 0.9 + lit * 0.07, (ambG + lit * 0.9) * 0.85, fo)
704 cB = mix(mix(0.028 + 0.045 * crest + dawnK * 0.09 + dk * 0.055, cget(2), fre) + sp * 0.65 + lit * 0.08, (ambB + lit * 0.65) * 0.85, fo)
705 fk = exp(-fogD * sS)
706 cR = mix(fogR, cR, fk)
707 cG = mix(fogG, cG, fk)
708 cB = mix(fogB, cB, fk)
709 }
710 }
712 # ---------- sky, horizon haze, lightning bolt
713 if (seaK < 0.5) {
714 sky(dx, dy, dz, 4)
715 hk = exp(-max(dy, 0) * (14 + 30 * stK)) * min(0.40 + 0.9 * stK, 1)
716 bx = boltU + 0.10 * sin(v * 9 + 3) + 0.05 * sin(v * 23 + boltU * 40) + 0.02 * sin(v * 61)
717 bolt = boltK * (exp(-abs(u - bx) * 120) + 0.25 * exp(-abs(u - bx) * 14)) * smooth(0.0, 0.08, dy)
718 cR = mix(cget(0), fogR, hk) + bolt * 0.9
719 cG = mix(cget(1), fogG, hk) + bolt * 0.95
720 cB = mix(cget(2), fogB, hk) + bolt * 1.2
721 }
723 # ---------- lighthouse: marched only inside its bounding column
724 sc = (dx * Lx + dz * Lz) / (dx * dx + dz * dz)
725 if (sc > 0 && len(dx * sc - Lx, dz * sc - Lz) < 30 && camY + dy * sc < 46) {
726 sT = max(sc - 36, 0)
727 dT = 1
728 repeat i 48 {
729 dT = lh(dx * sT - Lx, camY + dy * sT, dz * sT - Lz)
730 sT += max(dT, 0)
731 }
732 if (dT < 0.03 + sT * 0.0015 && sT < depth) {
733 depth = sT
734 qx = dx * sT - Lx
735 qy = camY + dy * sT
736 qz = dz * sT - Lz
737 mx = lh(qx + 0.06, qy, qz) - dT
738 my = lh(qx, qy + 0.06, qz) - dT
739 mz = lh(qx, qy, qz + 0.06) - dT
740 mk = 1 / sqrt(mx * mx + my * my + mz * mz + 0.0000001)
741 mx *= mk
742 my *= mk
743 mz *= mk
744 rr = len(qx, qz)
745 rkn = 0.5 + fbm(qx * 0.5, qz * 0.5 + qy * 0.7, 3)
746 alR = 0.070 * rkn
747 alG = 0.070 * rkn
748 alB = 0.080 * rkn
749 emR = 0
750 emG = 0
751 emB = 0
752 if (qy > 5.5 && rr < 4.65 - (qy - 6) * 0.055) {
753 band = step(fract((qy - 6) / 8.667), 0.5)
754 streak = 0.78 + 0.22 * fbm(atan2(qx, qz) * 4, qy * 0.25, 2)
755 alR = mix(0.72, 0.56, band) * streak
756 alG = mix(0.71, 0.07, band) * streak
757 alB = mix(0.67, 0.05, band) * streak
758 win = step(abs(atan2(qx, -qz) + 0.15), 0.13) * (step(abs(qy - 13), 0.8) + step(abs(qy - 20.5), 0.8) + step(abs(qy - 27), 0.7))
759 alR *= 1 - win
760 alG *= 1 - win
761 alB *= 1 - win
762 emR = win
763 emG = win * 0.62
764 emB = win * 0.22
765 }
766 if (qy > 31.9) {
767 alR = 0.05
768 alG = 0.055
769 alB = 0.06
770 emR = 0
771 emG = 0
772 emB = 0
773 }
774 if (qy > 32.7 && qy < 36.6 && rr < 2.6) {
775 mull = step(0.10, abs(fract(atan2(qx, qz) * 8 / tau) - 0.5)) * lampK
776 emR = mull * 1.5
777 emG = mull * 1.25
778 emB = mull * 0.7
779 }
780 if (qy >= 36.6) {
781 alR = 0.10
782 alG = 0.17
783 alB = 0.14
784 }
785 hem = (0.55 + 0.45 * my) * (0.55 + 0.45 * max(-mx * 0.6 - mz * 0.8, 0))
786 mo = max(my * 0.292 + mz * 0.885 - mx * 0.363, 0) * (1 - dawnK) * (1 - covK * 0.8)
787 lg = max(mx * boltU * 0.3 + my * 0.6 - mz * 0.74, 0) * flashK
788 sn = max(mx * sunX + my * sunY + mz * sunZ, 0) * dawnK
789 pd = sqrt(qx * qx + (34.6 - qy) * (34.6 - qy) + qz * qz) + 0.001
790 pl = max((my * (34.6 - qy) - mx * qx - mz * qz) / pd, 0) * lampK * 40 / (pd * pd + 12)
791 cR = alR * (ambR * hem + mo * 0.10 + lg * 1.6 + sn * 1.2 + pl) + emR
792 cG = alG * (ambG * hem + mo * 0.12 + lg * 1.7 + sn * 0.7 + pl * 0.8) + emG
793 cB = alB * (ambB * hem + mo * 0.16 + lg * 2.0 + sn * 0.4 + pl * 0.45) + emB
794 wl = (1 - smooth(0, 2.5 + 2.5 * stK, qy - swell(dx * sT, boatZ + dz * sT))) * (0.4 + 0.6 * fbm(qx * 0.6 + t * 0.5, qz * 0.6 + qy, 2)) * (0.3 + 0.7 * stK) * 0.8
795 cR = mix(cR, ambR * 0.9, wl)
796 cG = mix(cG, ambG * 0.9, wl)
797 cB = mix(cB, ambB * 0.9, wl)
798 fk = exp(-fogD * sT)
799 cR = mix(fogR, cR, fk)
800 cG = mix(fogG, cG, fk)
801 cB = mix(fogB, cB, fk)
802 }
803 }
805 # ---------- the beam: closest approach of the view ray to a line through the lamp
806 bb = dx * bdx + dz * bdz
807 rw = -(dx * Lx + dy * Ly + dz * Lz)
808 ee = -(bdx * Lx + bdz * Lz)
809 den = max(1 - bb * bb, 0.0008)
810 sb = clamp((bb * ee - rw) / den, 0, depth)
811 tb = ee + bb * sb
812 ox = dx * sb - Lx - bdx * tb
813 oy = dy * sb - Ly
814 oz = dz * sb - Lz - bdz * tb
815 rad = 0.9 + 0.045 * abs(tb)
816 core = exp(-(ox * ox + oy * oy + oz * oz) / (rad * rad))
817 glow = core * lampK * (0.25 + stK) * 2.2 / (rad * sqrt(den)) * exp(-abs(tb) * fogD * 0.7 - sb * fogD)
819 # ---------- lamp halo, storm bloom and the lens streak when the beam finds us
820 a2 = max(2 * (1 - (dx * Lx + dy * Ly + dz * Lz) / Ld), 0)
821 vis = lampK * step(Ld - 6, depth)
822 vy = dy - Ly / Ld
823 hl = vis * (0.000035 / (a2 + 0.000012) * (1 + 14 * glare) + exp(-a2 * (900 - 500 * stK)) * 0.25 * (1 + 5 * glare) + glare * exp(-a2 * 18) * 0.9)
824 hl += vis * exp(-vy * vy * 60000) * (0.02 + 0.6 * glare) / (1 + a2 * 300)
825 lightR = glow + hl
826 cR += lightR
827 cG += lightR * 0.93
828 cB += lightR * 0.70
830 # ---------- rain, visible where there is light to catch
831 rn = 0
832 repeat k 2 {
833 rxx = (u + v * (0.16 + 0.22 * stK)) * (36 + 26 * k)
834 hs = hash(floor(rxx) * 1.37 + k * 17.1)
835 ryy = fract(v * (1.5 + k * 0.7) + t * (5.5 + 3 * hs + k * 2) + hs * 9)
836 rn += smooth(0.90, 1.0, ryy) * (1 - abs(fract(rxx) - 0.5) * 2) ^ 3 * step(0.45, hs)
837 }
838 rn = rn * rainK * (0.05 + ambR * 0.25 + lightR * 0.7)
839 cR += rn
840 cG += rn * 1.02
841 cB += rn * 1.10
843 # ---------- the bow, a lantern on its stem
844 pv = v + camPitch * 0.35 + 0.012 * sin(t * 1.3)
845 hw = 1.25 * max(-0.56 - pv, 0) ^ 0.75
846 if (abs(u) < hw) {
847 ed = hw - abs(u)
848 rim = exp(-ed * 40)
849 plank = 0.75 + 0.25 * step(0.12, abs(fract(u / hw * 3.5) - 0.5))
850 lan = exp(-len(u, pv + 0.60) * 9) * (0.9 + 0.1 * sin(t * 9))
851 wet = ambR * 0.25 + glare * 0.5
852 cR = (0.016 + lan * 0.30 + ambR * 0.05) * plank + rim * (0.03 + wet)
853 cG = (0.013 + lan * 0.15 + ambG * 0.04) * plank + rim * (0.028 + wet)
854 cB = (0.012 + lan * 0.05 + ambB * 0.035) * plank + rim * (0.03 + wet)
855 }
856 post1 = step(abs(u), 0.012) * step(abs(pv + 0.51), 0.06)
857 cR = mix(cR, 0.02, post1)
858 cG = mix(cG, 0.016, post1)
859 cB = mix(cB, 0.014, post1)
860 ll = len(u, pv + 0.44)
861 lamp2 = exp(-ll * 70) * 1.2 + exp(-ll * 11) * 0.07
862 cR += lamp2
863 cG += lamp2 * 0.60
864 cB += lamp2 * 0.22
866 # ---------- title
867 if (titleK > 0.001 && u < -0.1 && v > 0.0) {
868 tx = (u + 1.32) / 0.20
869 ty = (0.56 - v) / 0.30
870 g1 = glyph(str(ttl, floor(tx)), fract(tx), ty) * step(0, tx) * step(tx, 3) * step(0, ty) * step(ty, 1)
871 tx = (u + 1.31) / 0.044
872 ty = (0.17 - v) / 0.066
873 g2 = glyph(str(cap, floor(tx)), fract(tx), ty) * step(0, tx) * step(tx, 25) * step(0, ty) * step(ty, 1)
874 gk = (g1 + g2 * 0.8 * smooth(0.5, 1, titleK)) * smooth(0, 0.6, titleK)
875 cR = mix(cR, 1.00, gk)
876 cG = mix(cG, 0.96, gk)
877 cB = mix(cB, 0.88, gk)
878 }
880 rgb(1 - exp(-cR * 1.7), 1 - exp(-cG * 1.7), 1 - exp(-cB * 1.7))
881 }
882}
884post {
885 a0 = tap(0, 0)
886 g0 = r1
887 b0 = r2
888 sR = 0
889 sG = 0
890 sB = 0
891 repeat k 8 {
892 an = k * 0.7854 + 0.3
893 rd = 3 + 4 * (k % 2)
894 tr = tap(cos(an) * rd, sin(an) * rd)
895 sR += tr * tr
896 sG += r1 * r1
897 sB += r2 * r2
898 }
899 ca = tap(u * 0.9, 0)
900 rgb(mix(a0, ca, 0.5) + sR * 0.045, g0 + sG * 0.040, b0 + sB * 0.045)
901 cmul(1 - 0.16 * (u * u * 0.4 + v * v))
902 gn = hash(x * w * 0.37 + y * h * 1.13 + frame * 7.7) - 0.5
903 cadd(gn * 0.028, gn * 0.028, gn * 0.032)
904 cmul(smooth(0, 1.5, t) * (1 - smooth(62.5, 64, t)))
905 cmul(step(abs(v), 0.835))
906}
Click a line number to link to that line.
GLITCH →