dmscene Demos & source

CRESCAT PRINT - MATERIALIZE

crescat-materialize.dmt · 125 BPM · 1:01 · 1280×720

model-madelongflashing3dcrescatdemosceneoriginalprintingproceduralraytracingwork-in-progress

warning Contains rapid camera motion and pulsing lights.

notes

CRESCAT PRINT / MATERIALIZE. A 61.44-second 3D demoscene film for Crescat's work-in-progress print daemon. Macro gears, an exploded print engine, a machine cathedral, a solid raster relief, flowing paper and a mechanical assembly.

musicOriginal industrial-electronic score at 125 BPM, extended from The Last Meter: metallic percussion, syncopated sub bass, delayed FM plucks and a rising finale.
visualAnalytic ray tracing of boxes and capped cylinders; per-object transforms; solid rotating gear teeth; cast shadows; secondary floor reflections; metal softbox reflections; voxel traversal of the real fictional badge raster; a segmented 3D paper ribbon. No rendered animation assets.
filecrescat-materialize.dmt
duration1:01
video1280×720 · 30 fps · h264 + audio · 27 MB
song125 BPM · speed 6 · rpb 4 · 8 channels
loop0
renderscale 2 · dither on · master 0.70
uniformsct shot phase drive spread lidOpen
modelGPT-6
linkhttps://crescat.io
tagsmodel-madelongflashing3dcrescatdemosceneoriginalprintingproceduralraytracingwork-in-progress
source1,119 lines · 75 KB · download

anatomy

21VM programs
24patterns
0palettes
0timeline events
6text / sample / texture
1,119source lines
12inst
4chan
1master
1frame
2pixel
1post
4fn

line composition

pattern 40%fn 32%pixel 9%frame 6%inst 5%post 3%chan 1%master 1%uniform 0%text 0%texture 0%title 0%song 0%order 0%pan 0%

play order

012345678910111213141516171819161718191617181920212223

order list · 32 entries

timeline

This demo has no timeline events; it is driven by the tracker clock and per-frame programs.

resources

kindnameinfovalue
textopening27THE LAST METER IS PHYSICAL.
textprintTitle5PRINT
textendline21FROM SCREEN TO SCENE.
textwip24WORK-IN-PROGRESS PREVIEW
texturewordmarkassets/crescat-wordmark.ppm
texturesampleBadgeassets/crescat-badge.ppm

source

download .dmt
1# @model GPT-6
2# @description CRESCAT PRINT / MATERIALIZE. A 61.44-second 3D demoscene film for Crescat's work-in-progress print daemon. Macro gears, an exploded print engine, a machine cathedral, a solid raster relief, flowing paper and a mechanical assembly.
3# @music Original industrial-electronic score at 125 BPM, extended from The Last Meter: metallic percussion, syncopated sub bass, delayed FM plucks and a rising finale.
4# @visual Analytic ray tracing of boxes and capped cylinders; per-object transforms; solid rotating gear teeth; cast shadows; secondary floor reflections; metal softbox reflections; voxel traversal of the real fictional badge raster; a segmented 3D paper ribbon. No rendered animation assets.
5# @tags crescat, printing, 3d, raytracing, demoscene, procedural, original, work-in-progress
6# @duration 61.44
7# @url https://crescat.io
8# @warning Contains rapid camera motion and pulsing lights.
9# The exaggerated machine is an artistic visualization, not actual printer internals.
10# The feature remains WIP. Source: crescat-print-daemon and printing-system-daemon/crescat.
11# Existing wordmark from crescat-website; badge is the unchanged fictional dk_22205_100.pdf fixture.
12# All geometry, camera paths, intersection routines, lighting and music are authored in this file.
13# Per-pixel scratch uniforms use dmscene's private worker snapshot, reset on every ray.
14title CRESCAT PRINT - MATERIALIZE
15song bpm=125 speed=6 rpb=4 channels=8 loop=0 volume=0.70 scale=2 dither=1
16order 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 16 17 18 19 16 17 18 19 20 21 22 23
17pan 0.5 0.5 0.65 0.5 0.32 0.64 0.46 0.55
18texture wordmark "assets/crescat-wordmark.ppm"
19texture sampleBadge "assets/crescat-badge.ppm"
20text opening "THE LAST METER IS PHYSICAL."
21text printTitle "PRINT"
22text endline "FROM SCREEN TO SCENE."
23text wip "WORK-IN-PROGRESS PREVIEW"
25inst kick {
26 f = 44 + 165 * exp(-t * 30)
27 $p = $p + f / sr
28 out(dist(sin($p * tau) * exp(-t * 8) + hp(noise(), 3200) * exp(-t * 100) * 0.1, 1.65) * 0.86)
30inst snare {
31 snareNoise = hp(noise(), 1600) * exp(-t * 19)
32 body = sin(tau * 170 * t) * exp(-t * 25)
33 out(dist(snareNoise * 0.65 + body * 0.3, 1.4) * 0.65)
35inst hats {
36 out(hp(noise(), 7000) * exp(-t * (75 - p0 * 52)) * 0.22)
38inst bass {
39 e = env(0.005, 0.19, 0.48, 0.07)
40 s = bsaw(ph, freq) * 0.5 + sin(ph * tau) * 0.65
41 out(svf(s, 130 + 1250 * exp(-t * 10) + p0 * 900, 0.24) * e * 0.64)
43inst pluck nna=continue {
44 e = exp(-t * 5.5) * min(t * 350, 1)
45 s = sin(ph * tau + sin(ph * tau * 3.01) * exp(-t * 8) * 3.2)
46 out(s * e * 0.35)
48inst minor nna=continue {
49 e = env(0.15, 0.7, 0.72, 1.1)
50 s = usaw(freq, 0.19) * 0.48 + usaw(freq * 1.189207, 0.11) * 0.25 + sin(ph * tau * 1.498307) * 0.35
51 out(lp(s, 600 + p0 * 2200) * e * 0.31)
53inst lead nna=continue {
54 e = env(0.01, 0.2, 0.40, 0.14)
55 s = usaw(freq, 0.22) * 0.6 + sin(ph * tau * 2) * 0.12
56 out(svf(s, 1000 + 3800 * exp(-t * 8), 0.2) * e * 0.38)
58inst riser {
59 e = env(0.2, 0.4, 0.8, 0.3)
60 a = svf(noise(), 200 + min(t / 1.8, 1) * 6000, 0.60)
61 out(r2 * e * 0.16)
63inst crash {
64 out(hp(noise(), 4500) * exp(-t * 1.8) * 0.20)
66inst major nna=continue {
67 e = env(0.15, 0.7, 0.72, 1.1)
68 s = usaw(freq, 0.19) * 0.48 + usaw(freq * 1.259921, 0.11) * 0.25 + sin(ph * tau * 1.498307) * 0.35
69 out(lp(s, 600 + p0 * 2200) * e * 0.31)
71inst mechanism {
72 f = 105 + 35 * exp(-t * 40)
73 metallic = sin(tau * f * t + sin(tau * 731 * t) * exp(-t * 40))
74 out((metallic * exp(-t * 35) + hp(noise(), 2400) * exp(-t * 80) * 0.15) * 0.35)
76inst impact {
77 f = 35 + 60 * exp(-t * 7)
78 $p = $p + f / sr
79 body = sin($p * tau) + sin($p * tau * 1.5) * 0.35
80 out(dist(body * exp(-t * 1.5), 2) * 0.4)
82chan 3 {
83 out(x * (0.38 + 0.62 * (1 - exp(-trig(0) * 13))))
85chan 4 {
86 d = dly(x, 0.36, 0.35)
87 out(x + d * 0.35)
89chan 5 {
90 rv = verb(x, 0.83, 0.50)
91 out((x + rv * 0.42) * (0.55 + 0.45 * (1 - exp(-trig(0) * 10))))
93chan 6 {
94 d = dly(x, 0.48, 0.30)
95 rv = verb(x, 0.75, 0.5)
96 out(x + d * 0.26 + rv * 0.13)
98master {
99 fade = smooth(0, 1, lbeat) * (1 - smooth(123, 128, lbeat))
100 ll = hp(l, 22)
101 rr = hp(r, 22)
102 out(dist(ll * 0.80, 1.1) * fade, dist(rr * 0.80, 1.1) * fade)
105pattern 0 rows=16 {
106 00: off | off | off | off | D-4 5 20 | D-3 6 22 S10 | off | C-2 12 30
107 01: . | . | . | . | . | . | . | .
108 02: . | . | . | . | . | . | . | .
109 03: . | . | . | . | . | . | . | .
110 04: . | . | . | . | F-4 5 20 | . | . | .
111 05: . | . | . | . | . | . | . | .
112 06: . | . | . | . | . | . | . | .
113 07: . | . | . | . | . | . | . | .
114 08: . | . | . | . | D-5 5 20 | . | . | .
115 09: . | . | . | . | . | . | . | .
116 10: . | . | . | . | . | . | . | .
117 11: . | . | . | . | . | . | . | .
118 12: . | . | . | . | F-4 5 20 | . | . | .
119 13: . | . | . | . | . | . | . | .
120 14: . | . | . | . | . | . | . | .
121 15: . | . | . | . | . | . | . | .
124pattern 1 rows=16 {
125 00: . | . | . | . | F-4 5 20 | . | . | .
126 01: . | . | . | . | . | . | . | .
127 02: . | . | . | . | . | . | . | .
128 03: . | . | . | . | . | . | . | .
129 04: . | . | . | . | D-5 5 20 | . | . | .
130 05: . | . | . | . | . | . | . | .
131 06: . | . | . | . | . | . | . | .
132 07: . | . | . | . | . | . | . | .
133 08: . | . | . | . | F-4 5 20 | . | . | .
134 09: . | . | . | . | . | . | . | .
135 10: . | . | . | . | . | . | . | .
136 11: . | . | . | . | . | . | . | .
137 12: . | . | . | . | D-4 5 20 | off | . | .
138 13: . | . | . | . | . | . | . | .
139 14: . | . | . | . | . | . | . | .
140 15: . | . | . | . | . | . | . | .
143pattern 2 rows=16 {
144 00: . | . | . | . | Bb3 5 20 | Bb2 10 22 S10 | . | .
145 01: . | . | . | . | . | . | . | .
146 02: . | . | . | . | . | . | . | .
147 03: . | . | . | . | . | . | . | .
148 04: . | . | . | . | D-4 5 20 | . | . | .
149 05: . | . | . | . | . | . | . | .
150 06: . | . | . | . | . | . | . | .
151 07: . | . | . | . | . | . | . | .
152 08: . | . | . | . | Bb4 5 20 | . | . | .
153 09: . | . | . | . | . | . | . | .
154 10: . | . | . | . | . | . | . | .
155 11: . | . | . | . | . | . | . | .
156 12: . | . | . | . | F-4 5 20 | . | . | .
157 13: . | . | . | . | . | . | . | .
158 14: . | . | . | . | . | . | . | .
159 15: . | . | . | . | . | . | . | .
162pattern 3 rows=16 {
163 00: . | . | . | . | D-4 5 20 | . | . | C-3 8 28
164 01: . | . | . | . | . | . | . | .
165 02: . | . | . | . | . | . | . | .
166 03: . | . | . | . | . | . | . | .
167 04: . | . | . | . | Bb4 5 20 | . | . | .
168 05: . | . | . | . | . | . | . | .
169 06: . | . | . | . | . | . | . | .
170 07: . | . | . | . | . | . | . | .
171 08: . | . | . | . | F-4 5 20 | . | . | .
172 09: . | . | . | . | . | . | . | .
173 10: . | . | . | . | . | . | . | .
174 11: . | . | . | . | . | . | . | .
175 12: . | C-3 2 24 | . | . | Bb3 5 20 | off | . | .
176 13: . | . | . | . | . | . | . | .
177 14: . | C-3 2 24 | . | . | . | . | . | .
178 15: . | C-3 2 24 | . | . | . | . | . | .
181pattern 4 rows=16 {
182 00: C-2 1 40 | . | . | . | F-4 5 20 | F-3 10 22 S10 | . | C-2 12 30
183 01: . | . | . | . | . | . | . | .
184 02: . | . | F#5 11 24 S80 | F-1 4 38 S10 | . | . | . | .
185 03: . | . | . | off | . | . | . | .
186 04: . | C-3 11 32 | F#5 11 12 S00 | . | A-4 5 20 | . | . | .
187 05: . | . | . | . | . | . | . | .
188 06: . | . | F#5 11 24 S80 | F-1 4 38 S10 | . | . | . | .
189 07: . | . | . | off | . | . | . | .
190 08: C-2 1 40 | . | F#5 11 12 S00 | . | F-5 5 20 | . | . | .
191 09: . | . | . | . | . | . | . | .
192 10: . | . | F#5 11 24 S80 | F-1 4 38 S10 | . | . | . | .
193 11: . | . | . | off | . | . | . | .
194 12: . | C-3 11 32 | F#5 11 12 S00 | . | A-4 5 20 | . | . | .
195 13: . | . | . | . | . | . | . | .
196 14: . | . | F#5 11 24 S80 | F-1 4 38 S10 | . | . | . | .
197 15: . | . | . | off | . | . | . | .
200pattern 5 rows=16 {
201 00: C-2 1 40 | . | . | . | A-4 5 20 | . | . | .
202 01: . | . | . | . | . | . | . | .
203 02: . | . | F#5 11 24 S80 | F-1 4 38 S10 | . | . | . | .
204 03: . | . | . | off | . | . | . | .
205 04: . | C-3 11 32 | F#5 11 12 S00 | . | F-5 5 20 | . | . | .
206 05: . | . | . | . | . | . | . | .
207 06: . | . | F#5 11 24 S80 | F-1 4 38 S10 | . | . | . | .
208 07: . | . | . | off | . | . | . | .
209 08: C-2 1 40 | . | F#5 11 12 S00 | . | A-4 5 20 | . | . | .
210 09: . | . | . | . | . | . | . | .
211 10: . | . | F#5 11 24 S80 | F-1 4 38 S10 | . | . | . | .
212 11: . | . | . | off | . | . | . | .
213 12: . | C-3 11 32 | F#5 11 12 S00 | . | F-4 5 20 | off | . | .
214 13: . | . | . | . | . | . | . | .
215 14: . | . | F#5 11 24 S80 | F-1 4 38 S10 | . | . | . | .
216 15: . | . | . | off | . | . | . | .
219pattern 6 rows=16 {
220 00: C-2 1 40 | . | . | . | C-4 5 20 | C-3 10 22 S10 | . | .
221 01: . | . | . | . | . | . | . | .
222 02: . | . | F#5 11 24 S80 | C-1 4 38 S10 | . | . | . | .
223 03: . | . | . | off | . | . | . | .
224 04: . | C-3 11 32 | F#5 11 12 S00 | . | E-4 5 20 | . | . | .
225 05: . | . | . | . | . | . | . | .
226 06: . | . | F#5 11 24 S80 | C-1 4 38 S10 | . | . | . | .
227 07: . | . | . | off | . | . | . | .
228 08: C-2 1 40 | . | F#5 11 12 S00 | . | C-5 5 20 | . | . | .
229 09: . | . | . | . | . | . | . | .
230 10: . | . | F#5 11 24 S80 | C-1 4 38 S10 | . | . | . | .
231 11: . | . | . | off | . | . | . | .
232 12: . | C-3 11 32 | F#5 11 12 S00 | . | E-4 5 20 | . | . | .
233 13: . | . | . | . | . | . | . | .
234 14: . | . | F#5 11 24 S80 | C-1 4 38 S10 | . | . | . | .
235 15: . | . | . | off | . | . | . | .
238pattern 7 rows=16 {
239 00: C-2 1 40 | . | . | . | E-4 5 20 | . | . | C-3 8 28
240 01: . | . | . | . | . | . | . | .
241 02: . | . | F#5 11 24 S80 | C-1 4 38 S10 | . | . | . | .
242 03: . | . | . | off | . | . | . | .
243 04: . | C-3 11 32 | F#5 11 12 S00 | . | C-5 5 20 | . | . | .
244 05: . | . | . | . | . | . | . | .
245 06: . | . | F#5 11 24 S80 | C-1 4 38 S10 | . | . | . | .
246 07: . | . | . | off | . | . | . | .
247 08: C-2 1 40 | . | F#5 11 12 S00 | . | E-4 5 20 | . | . | .
248 09: . | . | . | . | . | . | . | .
249 10: . | . | F#5 11 24 S80 | C-1 4 38 S10 | . | . | . | .
250 11: . | . | . | off | . | . | . | .
251 12: . | C-3 2 24 | F#5 11 12 S00 | . | C-4 5 20 | off | . | .
252 13: . | . | . | . | . | . | . | .
253 14: . | C-3 2 24 | F#5 11 24 S80 | C-1 4 38 S10 | . | . | . | .
254 15: . | C-3 2 24 | . | off | . | . | . | .
257pattern 8 rows=16 {
258 00: C-2 1 40 | . | . | . | D-4 5 27 | D-3 6 2C S80 | . | C-2 12 30
259 01: . | . | . | . | . | . | . | .
260 02: . | . | F#5 11 24 S80 | D-1 4 38 S10 | A-4 5 27 | . | . | .
261 03: . | . | . | off | . | . | . | .
262 04: . | . | F#5 11 12 S00 | . | F-4 5 27 | . | . | .
263 05: . | . | . | . | . | . | . | .
264 06: . | . | F#5 11 24 S80 | D-1 4 38 S10 | E-4 5 27 | . | . | .
265 07: . | . | . | off | . | . | . | .
266 08: C-2 1 40 | C-3 11 32 | F#5 11 12 S00 | . | D-5 5 27 | . | . | .
267 09: . | . | . | . | . | . | . | .
268 10: . | . | F#5 11 24 S80 | D-1 4 38 S10 | A-4 5 27 | . | . | .
269 11: . | . | . | off | . | . | . | .
270 12: . | . | F#5 11 12 S00 | . | F-4 5 27 | . | . | .
271 13: . | . | . | . | . | . | . | .
272 14: . | . | F#5 11 24 S80 | D-1 4 38 S10 | A-4 5 27 | . | . | .
273 15: . | . | . | off | . | . | . | .
276pattern 9 rows=16 {
277 00: C-2 1 40 | . | . | . | F-4 5 27 | . | . | .
278 01: . | . | . | . | . | . | . | .
279 02: . | . | F#5 11 24 S80 | D-1 4 38 S10 | E-4 5 27 | . | . | .
280 03: . | . | . | off | . | . | . | .
281 04: . | . | F#5 11 12 S00 | . | D-5 5 27 | . | . | .
282 05: . | . | . | . | . | . | . | .
283 06: . | . | F#5 11 24 S80 | D-1 4 38 S10 | A-4 5 27 | . | . | .
284 07: . | . | . | off | . | . | . | .
285 08: C-2 1 40 | C-3 11 32 | F#5 11 12 S00 | . | F-4 5 27 | . | . | .
286 09: . | . | . | . | . | . | . | .
287 10: . | . | F#5 11 24 S80 | D-1 4 38 S10 | A-4 5 27 | . | . | .
288 11: . | . | . | off | . | . | . | .
289 12: . | . | F#5 11 12 S00 | . | D-4 5 27 | off | . | .
290 13: . | . | . | . | . | . | . | .
291 14: . | . | F#5 11 24 S80 | D-1 4 38 S10 | A-4 5 27 | . | . | .
292 15: . | . | . | off | . | . | . | .
295pattern 10 rows=16 {
296 00: C-2 1 40 | . | . | . | Bb3 5 27 | Bb2 10 2C S80 | . | .
297 01: . | . | . | . | . | . | . | .
298 02: . | . | F#5 11 24 S80 | Bb0 4 38 S10 | F-4 5 27 | . | . | .
299 03: . | . | . | off | . | . | . | .
300 04: . | . | F#5 11 12 S00 | . | D-4 5 27 | . | . | .
301 05: . | . | . | . | . | . | . | .
302 06: . | . | F#5 11 24 S80 | Bb0 4 38 S10 | A-4 5 27 | . | . | .
303 07: . | . | . | off | . | . | . | .
304 08: C-2 1 40 | C-3 11 32 | F#5 11 12 S00 | . | Bb4 5 27 | . | . | .
305 09: . | . | . | . | . | . | . | .
306 10: . | . | F#5 11 24 S80 | Bb0 4 38 S10 | D-5 5 27 | . | . | .
307 11: . | . | . | off | . | . | . | .
308 12: . | . | F#5 11 12 S00 | . | F-4 5 27 | . | . | .
309 13: . | . | . | . | . | . | . | .
310 14: . | . | F#5 11 24 S80 | Bb0 4 38 S10 | A-4 5 27 | . | . | .
311 15: . | . | . | off | . | . | . | .
314pattern 11 rows=16 {
315 00: C-2 1 40 | . | . | . | D-4 5 27 | . | . | C-3 8 28
316 01: . | . | . | . | . | . | . | .
317 02: . | . | F#5 11 24 S80 | Bb0 4 38 S10 | A-4 5 27 | . | . | .
318 03: . | . | . | off | . | . | . | .
319 04: . | . | F#5 11 12 S00 | . | Bb4 5 27 | . | . | .
320 05: . | . | . | . | . | . | . | .
321 06: . | . | F#5 11 24 S80 | Bb0 4 38 S10 | D-5 5 27 | . | . | .
322 07: . | . | . | off | . | . | . | .
323 08: C-2 1 40 | C-3 11 32 | F#5 11 12 S00 | . | F-4 5 27 | . | . | .
324 09: . | . | . | . | . | . | . | .
325 10: . | . | F#5 11 24 S80 | Bb0 4 38 S10 | A-4 5 27 | . | . | .
326 11: . | . | . | off | . | . | . | .
327 12: . | C-3 2 24 | F#5 11 12 S00 | . | Bb3 5 27 | off | . | .
328 13: . | . | . | . | . | . | . | .
329 14: . | C-3 2 24 | F#5 11 24 S80 | Bb0 4 38 S10 | F-4 5 27 | . | . | .
330 15: . | C-3 2 24 | . | off | . | . | . | .
333pattern 12 rows=16 {
334 00: C-2 1 40 | . | . | . | F-4 5 27 | F-3 10 2C S80 | F-5 7 22 | C-2 12 30
335 01: . | . | . | . | . | . | . | .
336 02: . | . | F#5 3 24 S80 | F-1 4 38 S65 | C-5 5 27 | . | off | .
337 03: . | . | . | off | . | . | . | .
338 04: C-2 1 40 | C-3 11 32 | F#5 3 12 S00 | . | A-4 5 27 | . | . | .
339 05: . | . | . | . | . | . | A-4 7 22 | .
340 06: . | . | F#5 3 24 S80 | F-1 4 38 S65 | G-4 5 27 | . | . | .
341 07: . | . | . | off | . | . | off | .
342 08: C-2 1 40 | . | F#5 3 12 S00 | . | F-5 5 27 | . | G-4 7 22 | .
343 09: . | . | . | . | . | . | . | .
344 10: . | . | F#5 3 24 S80 | F-1 4 38 S65 | C-5 5 27 | . | off | .
345 11: . | . | . | off | . | . | . | .
346 12: C-2 1 40 | C-3 11 32 | F#5 3 12 S00 | . | A-4 5 27 | . | C-5 7 22 | .
347 13: . | . | . | . | . | . | . | .
348 14: . | . | F#5 3 24 S80 | F-1 4 38 S65 | C-5 5 27 | . | off | .
349 15: . | . | . | off | . | . | . | .
352pattern 13 rows=16 {
353 00: C-2 1 40 | . | . | . | A-4 5 27 | . | A-4 7 22 | .
354 01: . | . | . | . | . | . | . | .
355 02: . | . | F#5 3 24 S80 | F-1 4 38 S65 | G-4 5 27 | . | off | .
356 03: . | . | . | off | . | . | . | .
357 04: C-2 1 40 | C-3 11 32 | F#5 3 12 S00 | . | F-5 5 27 | . | . | .
358 05: . | . | . | . | . | . | G-4 7 22 | .
359 06: . | . | F#5 3 24 S80 | F-1 4 38 S65 | C-5 5 27 | . | . | .
360 07: . | . | . | off | . | . | off | .
361 08: C-2 1 40 | . | F#5 3 12 S00 | . | A-4 5 27 | . | C-5 7 22 | .
362 09: . | . | . | . | . | . | . | .
363 10: . | . | F#5 3 24 S80 | F-1 4 38 S65 | C-5 5 27 | . | off | .
364 11: . | . | . | off | . | . | . | .
365 12: C-2 1 40 | C-3 11 32 | F#5 3 12 S00 | . | F-4 5 27 | off | F-5 7 22 | .
366 13: . | . | . | . | . | . | . | .
367 14: . | . | F#5 3 24 S80 | F-1 4 38 S65 | C-5 5 27 | . | off | .
368 15: . | . | . | off | . | . | . | .
371pattern 14 rows=16 {
372 00: C-2 1 40 | . | . | . | C-4 5 27 | C-3 10 2C S80 | C-5 7 22 | .
373 01: . | . | . | . | . | . | . | .
374 02: . | . | F#5 3 24 S80 | C-1 4 38 S65 | G-4 5 27 | . | off | .
375 03: . | . | . | off | . | . | . | .
376 04: C-2 1 40 | C-3 11 32 | F#5 3 12 S00 | . | E-4 5 27 | . | . | .
377 05: . | . | . | . | . | . | E-4 7 22 | .
378 06: . | . | F#5 3 24 S80 | C-1 4 38 S65 | D-4 5 27 | . | . | .
379 07: . | . | . | off | . | . | off | .
380 08: C-2 1 40 | . | F#5 3 12 S00 | . | C-5 5 27 | . | D-4 7 22 | .
381 09: . | . | . | . | . | . | . | .
382 10: . | . | F#5 3 24 S80 | C-1 4 38 S65 | G-4 5 27 | . | off | .
383 11: . | . | . | off | . | . | . | .
384 12: C-2 1 40 | C-3 11 32 | F#5 3 12 S00 | . | E-4 5 27 | . | G-4 7 22 | .
385 13: . | . | . | . | . | . | . | .
386 14: . | . | F#5 3 24 S80 | C-1 4 38 S65 | G-4 5 27 | . | off | .
387 15: . | . | . | off | . | . | . | .
390pattern 15 rows=16 {
391 00: C-2 1 40 | . | . | . | E-4 5 27 | . | E-4 7 22 | C-3 8 28
392 01: . | . | . | . | . | . | . | .
393 02: . | . | F#5 3 24 S80 | C-1 4 38 S65 | D-4 5 27 | . | off | .
394 03: . | . | . | off | . | . | . | .
395 04: C-2 1 40 | C-3 11 32 | F#5 3 12 S00 | . | C-5 5 27 | . | . | .
396 05: . | . | . | . | . | . | D-4 7 22 | .
397 06: . | . | F#5 3 24 S80 | C-1 4 38 S65 | G-4 5 27 | . | . | .
398 07: . | . | . | off | . | . | off | .
399 08: C-2 1 40 | . | F#5 3 12 S00 | . | E-4 5 27 | . | G-4 7 22 | .
400 09: . | . | . | . | . | . | . | .
401 10: . | . | F#5 3 24 S80 | C-1 4 38 S65 | G-4 5 27 | . | off | .
402 11: . | . | . | off | . | . | . | .
403 12: C-2 1 40 | C-3 2 24 | F#5 3 12 S00 | . | C-4 5 27 | off | C-5 7 22 | .
404 13: . | . | . | . | . | . | . | .
405 14: . | C-3 2 24 | F#5 3 24 S80 | C-1 4 38 S65 | G-4 5 27 | . | off | .
406 15: . | C-3 2 24 | . | off | . | . | . | .
409pattern 16 rows=16 {
410 00: C-2 1 40 | . | . | . | D-4 5 27 | D-3 6 2C S80 | D-5 7 22 | C-2 12 30
411 01: . | . | . | . | . | . | . | .
412 02: . | . | F#5 3 24 S80 | D-1 4 38 S65 | A-4 5 27 | . | off | .
413 03: . | . | . | off | . | . | . | .
414 04: C-2 1 40 | C-3 11 32 | F#5 3 12 S00 | . | F-4 5 27 | . | . | .
415 05: . | . | . | . | . | . | F-4 7 22 | .
416 06: . | . | F#5 3 24 S80 | D-1 4 38 S65 | E-4 5 27 | . | . | .
417 07: . | . | . | off | . | . | off | .
418 08: C-2 1 40 | . | F#5 3 12 S00 | . | D-5 5 27 | . | E-4 7 22 | .
419 09: . | . | . | . | . | . | . | .
420 10: . | . | F#5 3 24 S80 | D-1 4 38 S65 | A-4 5 27 | . | off | .
421 11: . | . | . | off | . | . | . | .
422 12: C-2 1 40 | C-3 11 32 | F#5 3 12 S00 | . | F-4 5 27 | . | A-4 7 22 | .
423 13: . | . | . | . | . | . | . | .
424 14: . | . | F#5 3 24 S80 | D-1 4 38 S65 | A-4 5 27 | . | off | .
425 15: . | . | . | off | . | . | . | .
428pattern 17 rows=16 {
429 00: C-2 1 40 | . | . | . | F-4 5 27 | . | F-4 7 22 | .
430 01: . | . | . | . | . | . | . | .
431 02: . | . | F#5 3 24 S80 | D-1 4 38 S65 | E-4 5 27 | . | off | .
432 03: . | . | . | off | . | . | . | .
433 04: C-2 1 40 | C-3 11 32 | F#5 3 12 S00 | . | D-5 5 27 | . | . | .
434 05: . | . | . | . | . | . | E-4 7 22 | .
435 06: . | . | F#5 3 24 S80 | D-1 4 38 S65 | A-4 5 27 | . | . | .
436 07: . | . | . | off | . | . | off | .
437 08: C-2 1 40 | . | F#5 3 12 S00 | . | F-4 5 27 | . | A-4 7 22 | .
438 09: . | . | . | . | . | . | . | .
439 10: . | . | F#5 3 24 S80 | D-1 4 38 S65 | A-4 5 27 | . | off | .
440 11: . | . | . | off | . | . | . | .
441 12: C-2 1 40 | C-3 11 32 | F#5 3 12 S00 | . | D-4 5 27 | off | D-5 7 22 | .
442 13: . | . | . | . | . | . | . | .
443 14: . | . | F#5 3 24 S80 | D-1 4 38 S65 | A-4 5 27 | . | off | .
444 15: . | . | . | off | . | . | . | .
447pattern 18 rows=16 {
448 00: C-2 1 40 | . | . | . | Bb3 5 27 | Bb2 10 2C S80 | Bb4 7 22 | .
449 01: . | . | . | . | . | . | . | .
450 02: . | . | F#5 3 24 S80 | Bb0 4 38 S65 | F-4 5 27 | . | off | .
451 03: . | . | . | off | . | . | . | .
452 04: C-2 1 40 | C-3 11 32 | F#5 3 12 S00 | . | D-4 5 27 | . | . | .
453 05: . | . | . | . | . | . | D-4 7 22 | .
454 06: . | . | F#5 3 24 S80 | Bb0 4 38 S65 | A-4 5 27 | . | . | .
455 07: . | . | . | off | . | . | off | .
456 08: C-2 1 40 | . | F#5 3 12 S00 | . | Bb4 5 27 | . | A-4 7 22 | .
457 09: . | . | . | . | . | . | . | .
458 10: . | . | F#5 3 24 S80 | Bb0 4 38 S65 | D-5 5 27 | . | off | .
459 11: . | . | . | off | . | . | . | .
460 12: C-2 1 40 | C-3 11 32 | F#5 3 12 S00 | . | F-4 5 27 | . | F-4 7 22 | .
461 13: . | . | . | . | . | . | . | .
462 14: . | . | F#5 3 24 S80 | Bb0 4 38 S65 | A-4 5 27 | . | off | .
463 15: . | . | . | off | . | . | . | .
466pattern 19 rows=16 {
467 00: C-2 1 40 | . | . | . | D-4 5 27 | . | D-4 7 22 | C-3 8 28
468 01: . | . | . | . | . | . | . | .
469 02: . | . | F#5 3 24 S80 | Bb0 4 38 S65 | A-4 5 27 | . | off | .
470 03: . | . | . | off | . | . | . | .
471 04: C-2 1 40 | C-3 11 32 | F#5 3 12 S00 | . | Bb4 5 27 | . | . | .
472 05: . | . | . | . | . | . | A-4 7 22 | .
473 06: . | . | F#5 3 24 S80 | Bb0 4 38 S65 | D-5 5 27 | . | . | .
474 07: . | . | . | off | . | . | off | .
475 08: C-2 1 40 | . | F#5 3 12 S00 | . | F-4 5 27 | . | F-4 7 22 | .
476 09: . | . | . | . | . | . | . | .
477 10: . | . | F#5 3 24 S80 | Bb0 4 38 S65 | A-4 5 27 | . | off | .
478 11: . | . | . | off | . | . | . | .
479 12: C-2 1 40 | C-3 2 24 | F#5 3 12 S00 | . | Bb3 5 27 | off | Bb4 7 22 | .
480 13: . | . | . | . | . | . | . | .
481 14: . | C-3 2 24 | F#5 3 24 S80 | Bb0 4 38 S65 | F-4 5 27 | . | off | .
482 15: . | C-3 2 24 | . | off | . | . | . | .
485pattern 20 rows=16 {
486 00: C-2 1 40 | . | . | . | F-4 5 27 | F-3 10 2C S80 | F-5 7 22 | C-2 12 30
487 01: . | . | . | . | . | . | . | .
488 02: . | . | F#5 3 24 S80 | F-1 4 38 S65 | C-5 5 27 | . | off | .
489 03: . | . | . | off | . | . | . | .
490 04: C-2 1 40 | C-3 11 32 | F#5 3 12 S00 | . | A-4 5 27 | . | . | .
491 05: . | . | . | . | . | . | A-4 7 22 | .
492 06: . | . | F#5 3 24 S80 | F-1 4 38 S65 | G-4 5 27 | . | . | .
493 07: . | . | . | off | . | . | off | .
494 08: C-2 1 40 | . | F#5 3 12 S00 | . | F-5 5 27 | . | G-4 7 22 | .
495 09: . | . | . | . | . | . | . | .
496 10: . | . | F#5 3 24 S80 | F-1 4 38 S65 | C-5 5 27 | . | off | .
497 11: . | . | . | off | . | . | . | .
498 12: C-2 1 40 | C-3 11 32 | F#5 3 12 S00 | . | A-4 5 27 | . | C-5 7 22 | .
499 13: . | . | . | . | . | . | . | .
500 14: . | . | F#5 3 24 S80 | F-1 4 38 S65 | C-5 5 27 | . | off | .
501 15: . | . | . | off | . | . | . | .
504pattern 21 rows=16 {
505 00: C-2 1 40 | . | . | . | A-4 5 27 | . | A-4 7 22 | .
506 01: . | . | . | . | . | . | . | .
507 02: . | . | F#5 3 24 S80 | F-1 4 38 S65 | G-4 5 27 | . | off | .
508 03: . | . | . | off | . | . | . | .
509 04: C-2 1 40 | C-3 11 32 | F#5 3 12 S00 | . | F-5 5 27 | . | . | .
510 05: . | . | . | . | . | . | G-4 7 22 | .
511 06: . | . | F#5 3 24 S80 | F-1 4 38 S65 | C-5 5 27 | . | . | .
512 07: . | . | . | off | . | . | off | .
513 08: C-2 1 40 | . | F#5 3 12 S00 | . | A-4 5 27 | . | C-5 7 22 | .
514 09: . | . | . | . | . | . | . | .
515 10: . | . | F#5 3 24 S80 | F-1 4 38 S65 | C-5 5 27 | . | off | .
516 11: . | . | . | off | . | . | . | .
517 12: C-2 1 40 | C-3 11 32 | F#5 3 12 S00 | . | F-4 5 27 | off | F-5 7 22 | .
518 13: . | . | . | . | . | . | . | .
519 14: . | . | F#5 3 24 S80 | F-1 4 38 S65 | C-5 5 27 | . | off | .
520 15: . | . | . | off | . | . | . | .
523pattern 22 rows=16 {
524 00: C-2 1 40 | . | . | . | C-4 5 27 | C-3 10 2C S80 | C-5 7 22 | .
525 01: . | . | . | . | . | . | . | .
526 02: . | . | F#5 3 24 S80 | C-1 4 38 S65 | G-4 5 27 | . | off | .
527 03: . | . | . | off | . | . | . | .
528 04: C-2 1 40 | C-3 11 32 | F#5 3 12 S00 | . | E-4 5 27 | . | . | .
529 05: . | . | . | . | . | . | E-4 7 22 | .
530 06: . | . | F#5 3 24 S80 | C-1 4 38 S65 | D-4 5 27 | . | . | .
531 07: . | . | . | off | . | . | off | .
532 08: C-2 1 40 | . | F#5 3 12 S00 | . | C-5 5 27 | . | D-4 7 22 | .
533 09: . | . | . | . | . | . | . | .
534 10: . | . | F#5 3 24 S80 | C-1 4 38 S65 | G-4 5 27 | . | off | .
535 11: . | . | . | off | . | . | . | .
536 12: C-2 1 40 | C-3 11 32 | F#5 3 12 S00 | . | E-4 5 27 | . | G-4 7 22 | .
537 13: . | . | . | . | . | . | . | .
538 14: . | . | F#5 3 24 S80 | C-1 4 38 S65 | G-4 5 27 | . | off | .
539 15: . | . | . | off | . | . | . | .
542pattern 23 rows=16 {
543 00: C-2 1 40 | . | . | . | E-4 5 27 | . | E-4 7 22 | C-3 8 28
544 01: . | . | . | . | . | . | . | .
545 02: . | . | F#5 3 24 S80 | C-1 4 38 S65 | D-4 5 27 | . | off | .
546 03: . | . | . | off | . | . | . | .
547 04: C-2 1 40 | C-3 11 32 | F#5 3 12 S00 | . | C-5 5 27 | . | . | .
548 05: . | . | . | . | . | . | D-4 7 22 | .
549 06: . | . | F#5 3 24 S80 | C-1 4 38 S65 | G-4 5 27 | . | . | .
550 07: . | . | . | off | . | . | off | .
551 08: C-2 1 40 | . | F#5 3 12 S00 | . | E-4 5 27 | . | G-4 7 22 | .
552 09: . | . | . | . | . | . | . | .
553 10: off | off | off | off | off | off | off | off
554 11: . | . | . | . | . | . | . | .
555 12: . | . | . | . | . | . | . | .
556 13: . | . | . | . | . | . | . | .
557 14: . | . | . | . | . | . | . | .
558 15: . | . | . | . | . | . | . | .
562# Analytic ray tracer. These scratch uniforms are private to each pixel worker.
563# Every ray resets them; no geometry or shading depends on traversal order.
564uniform ct shot phase drive spread lidOpen
565uniform camX camY camZ aimX aimY aimZ roll focal fadeIn
566uniform rayX rayY rayZ dirX dirY dirZ nearT normX normY normZ surface hitU hitV
567uniform turnZ turnX texOffset texSpan coarse
568uniform boundsX boundsY boundsZ extentX extentY extentZ objectCount
570fn solid(shape, cx, cy, cz, ax, ay, az, materialCode) {
571 # Transform the ray into object space. All normals return to world space.
572 ox = rayX - cx
573 oy = rayY - cy
574 oz = rayZ - cz
575 dx = dirX
576 dy = dirY
577 dz = dirZ
578 # Conservative per-object sphere rejects empty rays before rotations/divisions.
579 # The exact intersection below is unchanged, including all hit distances.
580 dn = dx * dx + dy * dy + dz * dz
581 projection = -(ox * dx + oy * dy + oz * dz) / dn
582 radius2 = ax * ax + ay * ay
583 if (shape == 0) { radius2 += az * az }
584 radius2 += 0.00005 * (1 + radius2)
585 perpendicular2 = ox * ox + oy * oy + oz * oz - projection * projection * dn
586 reach = sqrt(radius2 / dn)
587 if (perpendicular2 <= radius2 && projection + reach > 0 && projection - reach < nearT) {
588 if (turnZ != 0) {
589 ox = rot(ox, oy, -turnZ); oy = r1
590 dx = rot(dx, dy, -turnZ); dy = r1
591 }
592 if (turnX != 0) {
593 oy = rot(oy, oz, -turnX); oz = r1
594 dy = rot(dy, dz, -turnX); dz = r1
595 }
596 dis = 10000
597 nnx = 0; nny = 0; nnz = 0
598 if (shape == 0) {
599 # Finite box, exact slab intersection, including rays parallel to a face.
600 ix = sign(dx + 0.00000001) / max(abs(dx), 0.00000001)
601 iy = sign(dy + 0.00000001) / max(abs(dy), 0.00000001)
602 iz = sign(dz + 0.00000001) / max(abs(dz), 0.00000001)
603 tx = -ox * ix; ty = -oy * iy; tz = -oz * iz
604 ex = abs(ax * ix); ey = abs(ay * iy); ez = abs(az * iz)
605 entry = max(tx - ex, max(ty - ey, tz - ez))
606 leave = min(tx + ex, min(ty + ey, tz + ez))
607 if (entry > 0.0001 && entry < leave && entry < nearT) {
608 dis = entry
609 if (entry == tx - ex) { nnx = -sign(dx) }
610 else {
611 if (entry == ty - ey) { nny = -sign(dy) }
612 else { nnz = -sign(dz) }
613 }
614 }
615 }
616 else {
617 # Cylinder along local Z, with genuine end caps and side walls.
618 aa = dx * dx + dy * dy
619 bb = ox * dx + oy * dy
620 cc = ox * ox + oy * oy - ax * ax
621 disc = bb * bb - aa * cc
622 if (disc >= 0 && aa > 0.000001) {
623 sideT = (-bb - sqrt(disc)) / aa
624 if (sideT > 0.0001 && abs(oz + dz * sideT) < ay && sideT < nearT) {
625 dis = sideT
626 nnx = (ox + dx * sideT) / ax
627 nny = (oy + dy * sideT) / ax
628 }
629 }
630 if (abs(dz) > 0.000001) {
631 capZ = -sign(dz) * ay
632 capT = (capZ - oz) / dz
633 if (capT > 0.0001 && capT < dis && capT < nearT) {
634 capX = ox + dx * capT; capY = oy + dy * capT
635 if (capX * capX + capY * capY < ax * ax) {
636 dis = capT; nnx = 0; nny = 0; nnz = -sign(dz)
637 }
638 }
639 }
640 }
641 if (dis < nearT) {
642 nearT = dis
643 surface = materialCode
644 hitU = (ox + dx * dis) / (2 * ax) + 0.5
645 hitV = texOffset - (oz + dz * dis) / (2 * az) * texSpan
646 if (materialCode == 8) { hitV = 0.5 - (oy + dy * dis) / (2 * ay) }
647 if (turnX != 0) { nny = rot(nny, nnz, turnX); nnz = r1 }
648 if (turnZ != 0) { nnx = rot(nnx, nny, turnZ); nny = r1 }
649 normX = nnx; normY = nny; normZ = nnz
650 }
651 }
654fn geometry() {
655 nearT = 10000; surface = 0
656 normX = 0; normY = 1; normZ = 0
657 turnX = 0; turnZ = 0; texOffset = 0; texSpan = 1
658 # Polished concrete is a real plane; the primary ray can reflect this world.
659 if (dirY < -0.00001) {
660 ground = (-0.55 - rayY) / dirY
661 if (ground > 0) { nearT = ground; surface = 1 }
662 }
663 # Conservative scene-level slab test. Empty rays never visit object geometry.
664 invX = sign(dirX + 0.00000001) / max(abs(dirX), 0.00000001)
665 invY = sign(dirY + 0.00000001) / max(abs(dirY), 0.00000001)
666 invZ = sign(dirZ + 0.00000001) / max(abs(dirZ), 0.00000001)
667 bx = (boundsX - rayX) * invX; by = (boundsY - rayY) * invY; bz = (boundsZ - rayZ) * invZ
668 ex = abs(extentX * invX); ey = abs(extentY * invY); ez = abs(extentZ * invZ)
669 enterBox = max(bx - ex, max(by - ey, bz - ez))
670 exitBox = min(bx + ex, min(by + ey, bz + ez))
671 if (exitBox > max(enterBox, 0) && enterBox < nearT) {
672 repeat obj 184 {
673 if (obj < objectCount) {
674 px = 0; py = 0; pz = 0
675 sx = 0; sy = 0; sz = 0
676 form = 0; mat = 2; active = 0
677 turnX = 0; turnZ = 0; texOffset = 0.5; texSpan = 1
678 # The same detailed mechanism in macro, exploded, assembly and hero shots.
679 if (shot < 2 || shot >= 5) {
680 if (obj == 0) { active = 1; sx = 1.9; sy = 0.13; sz = 1.30; py = -0.12; mat = 2 }
681 if (obj == 1) { active = 1; sx = 1.72; sy = 0.045; sz = 1.16; py = 0.13 + spread * 0.15; mat = 6 }
682 # Aluminium front/back crossmembers and side chassis rails.
683 if (obj >= 2 && obj < 6) {
684 active = 1; side = (obj % 2) * 2 - 1
685 sx = 1.86; sy = 0.09; sz = 0.07; py = 0.42 + floor((obj - 2) / 2) * 1.0
686 pz = side * (1.12 + spread * 0.65); mat = 3
687 }
688 if (obj >= 6 && obj < 10) {
689 active = 1; px = (obj % 2 * 2 - 1) * (1.65 + spread * 0.4)
690 pz = (floor((obj - 6) / 2) * 2 - 1) * (0.96 + spread * 0.5)
691 py = 0.80; sx = 0.065; sy = 0.75; sz = 0.085; mat = 3
692 }
693 # Three solid roller drums. A 90-degree Z rotation leaves the cylinder Z axis;
694 # X rotation turns it vertical, so the body uses a Z spindle and the camera
695 # is choreographed to see its metal end caps and moving circumferences.
696 if (obj >= 10 && obj < 13) {
697 active = 1; j = obj - 10; form = 1
698 px = (j - 1) * (1.06 + spread * 0.38)
699 py = 0.78 + (j == 1) * (0.28 + spread * 0.7)
700 pz = 0; sx = 0.43 - (j == 1) * 0.08; sy = 0.97; sz = 1; mat = 7
701 }
702 # Concentric collars, hubs and axles on both ends of every roller.
703 if (obj >= 13 && obj < 31) {
704 active = 1; j = floor((obj - 13) / 6); k = (obj - 13) % 6
705 side = (k % 2) * 2 - 1; layer = floor(k / 2)
706 form = 1; px = (j - 1) * (1.06 + spread * 0.38)
707 py = 0.78 + (j == 1) * (0.28 + spread * 0.7)
708 pz = side * (1.04 + layer * (0.095 + spread * 0.13))
709 sx = 0.49 - layer * 0.14; sy = 0.055; sz = 1
710 mat = 3 + (layer == 1) * 6
711 }
712 # 48 independently rotating solid gear teeth, two driven wheels.
713 if (obj >= 31 && obj < 79 && coarse < 2) {
714 active = 1; j = floor((obj - 31) / 24); k = (obj - 31) % 24
715 angle = k / 24 * tau + drive * (1 - j * 2)
716 gx = (j * 2 - 1) * (1.06 + spread * 0.38)
717 px = gx + cos(angle) * 0.50; py = 0.78 + sin(angle) * 0.50
718 pz = -1.08 - spread * 0.20
719 sx = 0.09; sy = 0.036; sz = 0.075; turnZ = angle; mat = 9
720 }
721 # Heat-sink fins, spaced in 3D above the print head.
722 if (obj >= 79 && obj < 95) {
723 active = 1; j = obj - 79
724 px = -1.20 + j * 0.16; py = 1.62 + spread * 0.75
725 pz = 0.55 + spread * 0.30
726 sx = 0.024; sy = 0.18; sz = 0.43; mat = 3
727 }
728 if (obj == 95) {
729 active = 1; px = 0; py = 1.43 + spread * 0.75; pz = 0.55 + spread * 0.30
730 sx = 1.31; sy = 0.07; sz = 0.49; mat = 2
731 }
732 if (obj == 96) {
733 active = 1; py = 1.34 + spread * 0.75; pz = 0.11 + spread * 0.30
734 sx = 1.25; sy = 0.016; sz = 0.035; mat = 4
735 }
736 # Housing separates in the exploded view, then locks around the mechanism.
737 if (obj == 97) {
738 active = 1; py = 1.90 + lidOpen * 2.0; pz = 0.05
739 sx = 1.93; sy = 0.075; sz = 1.34; mat = 2
740 }
741 if (obj == 98 || obj == 99) {
742 active = 1; px = (obj == 98 ? -1 : 1) * (1.96 + lidOpen * 1.3)
743 py = 0.85 + lidOpen * 0.30; sx = 0.07; sy = 0.98; sz = 1.33; mat = 2
744 }
745 if (obj == 100) {
746 active = 1; py = 1.60; pz = -1.37 - lidOpen * 1.5
747 sx = 1.90; sy = 0.24; sz = 0.06; mat = 8
748 }
749 if (obj == 101) {
750 active = 1; py = 0.12; pz = -1.37 - lidOpen * 1.5
751 sx = 1.90; sy = 0.22; sz = 0.06; mat = 2
752 }
753 if (obj == 102) {
754 active = 1; px = 1.61; py = 1.64; pz = -1.439 - lidOpen * 1.5
755 sx = 0.04; sy = 0.012; sz = 0.004; mat = 4
756 }
757 # Four rubber feet, PCB ICs and discrete bolts.
758 if (obj >= 103 && obj < 107) {
759 active = 1; j = obj - 103; form = 1; turnX = pi * 0.5
760 px = (j % 2 * 2 - 1) * 1.54; pz = (floor(j / 2) * 2 - 1) * 0.97
761 py = -0.37; sx = 0.15; sy = 0.13; sz = 1; mat = 7
762 }
763 if (obj >= 107 && obj < 115 && coarse == 0) {
764 active = 1; j = obj - 107; px = -1.35 + (j % 4) * 0.8
765 pz = -0.76 + floor(j / 4) * 1.5; py = 0.23 + spread * 0.15
766 sx = 0.12; sy = 0.048; sz = 0.09; mat = 7
767 }
768 # Output badge is a textured solid sheet, tipped towards the viewer.
769 if (obj == 115 && shot >= 5) {
770 active = 1
771 feed = smooth(38.4, 45.5, ct)
772 sx = 0.63; sy = 0.009; sz = 1.015 * feed
773 py = 0.86 - feed * 0.36; pz = -1.05 - feed * 0.93
774 turnX = -0.34; mat = 5; texSpan = feed; texOffset = 1 - feed * 0.5
775 }
777 # Insulated signal looms: 48 solid tube segments arch around the drums.
778 if (obj >= 120 && obj < 168 && coarse == 0) {
779 active = 1; j = (obj - 120) % 24; side = floor((obj - 120) / 24) * 2 - 1
780 a = (j + 0.5) / 24 * pi
781 px = side * (1.54 + spread * 0.40) + sin(a * 10) * 0.035
782 py = 0.26 + sin(a) * (0.77 + spread * 0.20)
783 pz = -0.13 + cos(a) * 0.85
784 form = 1; sx = 0.034; sy = 0.075; sz = 1
785 turnX = atan2(-cos(a) * (0.77 + spread * 0.20), -sin(a) * 0.85)
786 mat = 9
787 }
788 # Recess-colored top vents carry physical depth and cast narrow shadows.
789 if (obj >= 168 && obj < 184 && shot >= 5) {
790 active = 1; j = obj - 168
791 px = 0.72 + (j % 8) * 0.115; pz = -0.30 + floor(j / 8) * 0.65
792 py = 1.978 + lidOpen * 2
793 sx = 0.028; sy = 0.006; sz = 0.24; mat = 7
794 }
795 # The first two shots expose the mechanism completely; the shell arrives later.
796 if (shot < 2 && obj >= 97 && obj <= 102) { active = 0 }
797 }
798 # A camera flight through an industrial colonnade of drums and crossbraces.
799 if (shot == 2 && obj < 120) {
800 active = 1; bay = floor(obj / 10); part = obj % 10
801 pz = floor(camZ / 3.2) * 3.2 + bay * 3.2 - 3.2
802 if (part < 2) {
803 px = (part * 2 - 1) * 2.7; py = 0.75; form = 1
804 turnX = pi * 0.5; sx = 0.40; sy = 1.30; sz = 1; mat = 3
805 }
806 if (part >= 2 && part < 4) {
807 px = ((part - 2) * 2 - 1) * 2.7; py = 2.2
808 sx = 0.56; sy = 0.12; sz = 0.56; mat = 9
809 }
810 if (part == 4) { py = 2.5; sx = 3.2; sy = 0.10; sz = 0.16; mat = 2 }
811 if (part == 5) { py = 2.38; sx = 2.32; sy = 0.018; sz = 0.075; mat = 4 }
812 if (part == 6) { py = -0.40; sx = 2.2; sy = 0.06; sz = 0.18; mat = 3 }
813 if (part == 7) { py = -0.31; sx = 0.014; sy = 0.02; sz = 1.58; mat = 4 }
814 if (part >= 8) {
815 px = ((part - 8) * 2 - 1) * 3.0; py = 0.75
816 sx = 0.08; sy = 0.08; sz = 1.62; mat = 9
817 }
818 }
819 # A travelling ribbon. Each narrow strip is a solid quad in its own frame.
820 # Its continuous PDF UV coordinates are carried with the geometry.
821 if (shot == 4) {
822 if (obj < 72) {
823 active = 1; j = obj
824 zz = -5.4 + j * 0.15
825 curve = zz * 0.65 + ct * 0.20
826 px = sin(zz * 0.28) * 0.5
827 py = 0.85 + 0.70 * sin(curve)
828 pz = zz
829 turnX = -atan2(0.455 * cos(curve), 1)
830 turnZ = 0.23 * sin(zz * 0.5 + ct * 0.12)
831 sx = 0.76; sy = 0.008; sz = 0.080 / cos(turnX)
832 mat = 5; texOffset = fract((zz + ct * 0.8) / 2.45)
833 texSpan = 0.16 / 2.45
834 }
835 if (obj >= 72 && obj < 84) {
836 active = 1; j = obj - 72; pz = -4.5 + floor(j / 3) * 3
837 part = j % 3
838 py = 0.25; px = (part - 1) * 1.28
839 form = 1; sx = 0.32; sy = 0.14; sz = 1; mat = 3
840 if (part == 1) { form = 0; sx = 1.4; sy = 0.07; sz = 0.09; py = -0.12; mat = 9 }
841 }
842 }
843 if (active > 0) { solid(form, px, py, pz, sx, sy, sz, mat) }
844 }
845 }
846 }
849fn illuminate() {
850 hx = rayX + dirX * nearT
851 hy = rayY + dirY * nearT
852 hz = rayZ + dirZ * nearT
853 nd = dirX * normX + dirY * normY + dirZ * normZ
854 ex = dirX - 2 * nd * normX
855 ey = dirY - 2 * nd * normY
856 ez = dirZ - 2 * nd * normZ
857 # Two large studio softboxes reflected in metal, not painted highlight lines.
858 key = pow(max(0, ex * -0.40 + ey * 0.84 + ez * -0.36), 28)
859 strip = pow(max(0, ex * 0.78 + ey * 0.52 + ez * 0.35), 72)
860 sky = 0.08 + 0.16 * max(ey, 0)
861 diffuse = max(0, normX * -0.40 + normY * 0.84 - normZ * 0.36)
862 fill = max(0, normX * 0.74 + normY * 0.24 + normZ * 0.62)
863 fresnel = pow(1 - max(0, -nd), 4)
864 ar = 0.065; ag = 0.10; ab = 0.12
865 metal = 0.65; emission = 0
866 rough = 0.90 + 0.10 * sin(hx * 170 + hz * 19)
867 if (surface == 1) {
868 # Subtle seams are in the concrete surface, with actual geometry reflected.
869 seam = step(0.985, fract(hx * 0.35)) + step(0.985, fract(hz * 0.35))
870 ar = 0.035 - seam * 0.009; ag = 0.060 - seam * 0.012; ab = 0.066 - seam * 0.012
871 metal = 0.22
872 }
873 if (surface == 3) { ar = 0.42; ag = 0.48; ab = 0.48; metal = 1 }
874 if (surface == 4) { ar = 0.08; ag = 0.72; ab = 0.58; emission = 1.4 + 0.45 * exp(-fract(ct / 0.48) * 8); metal = 0.3 }
875 if (surface == 5) {
876 ink = tex(sampleBadge, hitU, fract(hitV))
877 # Paper stays paper under both the teal key and the warm industrial fill.
878 ar = 0.09 + ink * 0.84; ag = 0.10 + ink * 0.83; ab = 0.10 + ink * 0.76
879 metal = 0.035; rough = 1
880 }
881 if (surface == 6) {
882 path = step(0.91, fract(hx * 6.5)) * step(0.25, fract(hz * 3.5))
883 path = max(path, step(0.94, fract(hz * 7.0)) * step(0.20, fract(hx * 3.1)))
884 ar = 0.02 + path * 0.24; ag = 0.19 + path * 0.28; ab = 0.14 + path * 0.09; metal = 0.5
885 }
886 if (surface == 7) {
887 grooves = 0.5 + 0.5 * sin(hz * 132 + drive * 3)
888 ar = 0.025 + grooves * 0.012; ag = 0.033 + grooves * 0.012; ab = 0.038 + grooves * 0.012; metal = 0.25
889 }
890 if (surface == 8) {
891 logoU = (hitU - 0.5) * 1.55 + 0.5
892 logoV = (hitV - 0.5) * 1.6 + 0.5
893 logo = tex(wordmark, logoU, logoV) * step(0, logoU) * step(logoU, 1) * step(0, logoV) * step(logoV, 1)
894 ar = ar + logo * 0.7; ag = ag + logo * 0.74; ab = ab + logo * 0.7
895 }
896 if (surface == 9) { ar = 0.52; ag = 0.26; ab = 0.11; metal = 0.93 }
897 contact = 0.70 + 0.30 * smooth(-0.52, 0.2, hy)
898 refl = (sky + key * 2.9 + strip * 2.2) * metal * rough
899 rr = ar * (0.24 + diffuse * 1.25 + fill * 0.24) * contact + refl * (0.34 + ar) + fresnel * 0.04 + ar * emission
900 gg = ag * (0.28 + diffuse * 1.15 + fill * 0.38) * contact + refl * (0.49 + ag) + fresnel * 0.12 + ag * emission
901 bb = ab * (0.31 + diffuse * 1.10 + fill * 0.36) * contact + refl * (0.52 + ab) + fresnel * 0.13 + ab * emission
902 fog = exp(-nearT * 0.018)
903 rr = mix(0.016, rr, fog); gg = mix(0.033, gg, fog); bb = mix(0.042, bb, fog)
904 rgb(pow(rr / (0.48 + rr), 0.77), pow(gg / (0.48 + gg), 0.77), pow(bb / (0.48 + bb), 0.77))
905 if (surface == 0) {
906 glow = pow(max(0, dirX * -0.3 + dirY * 0.2 + dirZ * 0.9), 12)
907 rgb(0.071 + glow * 0.018, 0.121 + glow * 0.058, 0.144 + glow * 0.065)
908 }
911fn letter(s, left, top, size) {
912 xx = (u - left) / size; yy = (top - v) / (size * 1.35)
913 return glyph(str(s, floor(xx)), fract(xx), yy) * step(0, xx) * step(xx, strlen(s)) * step(0, yy) * step(yy, 1)
916frame {
917 ct = lbeat * 0.48
918 shot = min(floor(ct / 7.68), 7)
919 phase = fract(ct / 7.68)
920 drive = ct * 0.7 + floor(lbeat) * 0.10 + smooth(0, 0.30, fract(lbeat)) * 0.10
921 spread = 0.5; lidOpen = 1
922 roll = 0; focal = 1.9
923 camX = 4; camY = 3; camZ = -6
924 aimX = 0; aimY = 0.75; aimZ = 0
925 if (shot == 0) {
926 pullback = smooth(0.10, 1, phase)
927 camX = mix(-1.6, 3.1, pullback); camY = mix(1.15, 2.2, pullback)
928 camZ = mix(-2.10, -4.8, pullback); aimX = mix(-1.1, -0.35, pullback); aimY = 0.85; aimZ = mix(-1.05, -0.2, pullback)
929 spread = 0.15; lidOpen = 1.1; focal = 1.85
930 }
931 if (shot == 1) {
932 angle = -0.6 + phase * 1.4
933 camX = sin(angle) * 5.7; camY = 2.8 + phase * 0.8; camZ = -cos(angle) * 5.7; focal = 2.15
934 aimY = 1.0; spread = 0.25 + smooth(0, 0.65, phase) * 0.95
935 lidOpen = 0.65 + smooth(0, 0.75, phase) * 0.65; roll = sin(phase * pi) * 0.055
936 }
937 if (shot == 2) {
938 camX = sin(phase * tau) * 0.8; camY = 0.48 + sin(phase * pi) * 0.45
939 camZ = phase * 19; aimX = -camX * 0.3; aimY = 1.05; aimZ = camZ + 8
940 roll = 0.09 * sin(phase * tau); focal = 1.6
941 }
942 if (shot == 3) {
943 rise = smooth(0.3, 1, phase)
944 camX = mix(0.9, 2.5, rise); camY = mix(0.58, 4.4, rise)
945 camZ = mix(-2.70, -4.0, rise); aimX = 0; aimY = 0.08; aimZ = mix(-1.20, 0, rise)
946 focal = 2.0
947 }
948 if (shot == 4) {
949 camX = 3.7 + 1.5 * phase; camY = 2.7 + sin(phase * pi) * 1.2
950 camZ = -4.7 + phase * 5; aimZ = 0; aimY = 0.7
951 roll = -0.08; focal = 1.7
952 }
953 if (shot == 5) {
954 camX = 4.8 - phase * 2; camY = 3.5 - phase * 0.9; camZ = -6.8
955 aimY = 0.6; aimZ = -0.4
956 spread = (1 - smooth(0, 0.7, phase)) * 1.2
957 lidOpen = (1 - smooth(0.15, 0.85, phase)) * 1.3
958 }
959 if (shot == 6) {
960 angle = 0.38 - phase * 0.95
961 camX = sin(angle) * 6.8; camY = 3.5 + phase * 0.8; camZ = -cos(angle) * 6.8
962 aimY = 0.55; aimZ = -0.5; spread = 0; lidOpen = 0
963 }
964 if (shot == 7) {
965 camX = -3.3 - phase * 0.8; camY = 3.2; camZ = -7.2 - phase * 0.5
966 aimX = -1.8; aimY = 0.75; aimZ = -0.2; spread = 0; lidOpen = 0; focal = 1.8
967 }
968 boundsX = 0; boundsY = 1.2; boundsZ = 0
969 extentX = 2.6; extentY = 1.8; extentZ = 1.65; objectCount = 168
970 if (shot >= 5) {
971 boundsY = 0.78 + lidOpen; boundsZ = -0.7
972 extentX = 2.05 + lidOpen * 1.35; extentY = 1.36 + lidOpen; extentZ = 2.45
973 objectCount = 184
974 }
975 if (shot == 2) {
976 boundsY = 1.0; boundsZ = floor(camZ / 3.2) * 3.2 + 14.4
977 extentX = 3.3; extentY = 1.65; extentZ = 19.25; objectCount = 120
978 }
979 if (shot == 4) {
980 boundsY = 0.65; extentX = 1.8; extentY = 1.25; extentZ = 5.6; objectCount = 84
981 }
982 fadeIn = smooth(0, 1.6, ct) * (1 - smooth(59.8, 61.44, ct))
983 select(shot == 3 ? 1 : 0)
986pixel machine {
987 fx = aimX - camX; fy = aimY - camY; fz = aimZ - camZ
988 fl = sqrt(fx * fx + fy * fy + fz * fz)
989 fx /= fl; fy /= fl; fz /= fl
990 rl = max(len(fz, fx), 0.001)
991 rightX = fz / rl; rightZ = -fx / rl
992 upX = fy * rightZ; upY = fz * rightX - fx * rightZ; upZ = -fy * rightX
993 # Orthonormal look-at basis; the raster is never mirrored.
994 uu = rot(u, v, roll); vv = r1
995 rayX = camX; rayY = camY; rayZ = camZ
996 dirX = fx * focal + rightX * uu + upX * vv
997 dirY = fy * focal + upY * vv
998 dirZ = fz * focal + rightZ * uu + upZ * vv
999 dl = sqrt(dirX * dirX + dirY * dirY + dirZ * dirZ)
1000 dirX /= dl; dirY /= dl; dirZ /= dl
1001 primaryR = 0; primaryG = 0; primaryB = 0
1002 reflX = 0; reflY = 1; reflZ = 0
1003 posX = 0; posY = 0; posZ = 0
1004 isFloor = 0; shadowable = 0; originalSurface = 0
1005 # Primary, true occlusion shadow, and a secondary floor-reflection ray.
1006 repeat pass 3 {
1007 if (pass < 2 || isFloor > 0) {
1008 coarse = pass
1009 geometry()
1010 if (pass == 1) {
1011 shade = 1
1012 if (surface > 1 && shadowable > 0) { shade = 0.62 }
1013 primaryR *= shade; primaryG *= shade; primaryB *= shade
1014 rayX = posX; rayY = posY + 0.006; rayZ = posZ
1015 dirX = reflX; dirY = reflY; dirZ = reflZ
1017 else {
1018 illuminate()
1019 if (pass == 0) {
1020 primaryR = cget(0); primaryG = cget(1); primaryB = cget(2)
1021 isFloor = surface == 1
1022 shadowable = surface > 0 && surface != 4
1023 originalSurface = surface
1024 posX = rayX + dirX * nearT; posY = rayY + dirY * nearT; posZ = rayZ + dirZ * nearT
1025 reflX = dirX; reflY = -dirY; reflZ = dirZ
1026 rayX = posX + normX * 0.006; rayY = posY + normY * 0.006; rayZ = posZ + normZ * 0.006
1027 dirX = -0.40; dirY = 0.84; dirZ = -0.36
1029 else {
1030 primaryR = primaryR * 0.75 + cget(0) * 0.30
1031 primaryG = primaryG * 0.75 + cget(1) * 0.34
1032 primaryB = primaryB * 0.75 + cget(2) * 0.35
1037 rgb(primaryR, primaryG, primaryB)
1040# Discrete voxel traversal of the badge raster. Each texel becomes a solid
1041# column, intersected analytically; the QR is geometry, not a flat decal.
1042pixel raster {
1043 fx = aimX - camX; fy = aimY - camY; fz = aimZ - camZ
1044 fl = sqrt(fx * fx + fy * fy + fz * fz)
1045 fx /= fl; fy /= fl; fz /= fl
1046 rl = len(fz, fx)
1047 rightX = fz / rl; rightZ = -fx / rl
1048 upX = fy * rightZ; upY = fz * rightX - fx * rightZ; upZ = -fy * rightX
1049 rayX = camX; rayY = camY; rayZ = camZ
1050 dirX = fx * focal + rightX * u + upX * v
1051 dirY = fy * focal + upY * v
1052 dirZ = fz * focal + rightZ * u + upZ * v
1053 dl = sqrt(dirX * dirX + dirY * dirY + dirZ * dirZ)
1054 dirX /= dl; dirY /= dl; dirZ /= dl
1055 nearT = 10000; surface = 0; normX = 0; normY = 1; normZ = 0
1056 turnX = 0; turnZ = 0; texOffset = 0.5; texSpan = 1
1057 ground = (-0.10 - rayY) / dirY
1058 if (ground > 0) { nearT = ground; surface = 2 }
1059 tt = max(0, (0.48 - rayY) / dirY)
1060 done = 0
1061 repeat cell 256 {
1062 if (done == 0 && tt < nearT) {
1063 xx = rayX + dirX * tt; zz = rayZ + dirZ * tt
1064 ix = floor((xx + 1.24) / 0.02); iz = floor((zz + 2) / 0.02)
1065 cx = ix * 0.02 - 1.23; cz = iz * 0.02 - 1.99
1066 # Step to the next X or Z cell boundary, retaining the exact order.
1067 exitX = (cx + sign(dirX) * 0.01001 - rayX) / dirX
1068 exitZ = (cz + sign(dirZ) * 0.01001 - rayZ) / dirZ
1069 nextT = min(exitX, exitZ)
1070 if (ix >= 0 && ix < 124 && iz >= 0 && iz < 200) {
1071 ink = tex(sampleBadge, (ix + 0.5) / 124, 1 - (iz + 0.5) / 200)
1072 scan = smooth(-2, 2, phase * 6 - cz - 1)
1073 height = 0.025 + (1 - ink) * 0.34 * scan * smooth(0.025, 0.075, (iz + 0.5) / 200)
1074 before = nearT
1075 mat = 3
1076 if (ink < 0.65) { mat = 9 }
1077 solid(0, cx, height * 0.5, cz, 0.0095, height * 0.5, 0.0095, mat)
1078 if (nearT < before) { done = 1 }
1080 tt = max(tt + 0.001, nextT + 0.0001)
1083 illuminate()
1084 # A narrow thermal sweep crosses the relief in world coordinates.
1085 hx = rayX + dirX * nearT; hz = rayZ + dirZ * nearT
1086 heat = exp(-abs(hz - (phase * 6 - 3)) * 28) * step(abs(hx), 1.25)
1087 cadd(heat * 0.12, heat * 0.85, heat * 0.58)
1090post {
1091 rr = tap(0, 0); gg = r1; bb = r2
1092 # Soft multi-radius bloom, then a gentle filmic shoulder. Never full-white cuts.
1093 br = 0; bg = 0; bl = 0
1094 repeat tapIndex 8 {
1095 aa = tapIndex * pi / 4
1096 vr = tap(cos(aa) * 5, sin(aa) * 5); vg = r1; vb = r2
1097 br += max(0, vr - 0.55); bg += max(0, vg - 0.55); bl += max(0, vb - 0.55)
1099 rr += br * 0.085; gg += bg * 0.085; bb += bl * 0.085
1100 rgb(rr, gg, bb)
1101 vignette = 1 - 0.12 * min(1, len(u / aspect, v))
1102 cmul(vignette)
1103 # Copy only at the opening and final resolve; geometry carries the story.
1104 if (shot == 0) {
1105 a = smooth(0.3, 1.8, ct) * (1 - smooth(4.5, 6.0, ct))
1106 tx = letter(opening, -1.37, -0.66, 0.060) * a
1107 cadd(tx * 0.80, tx * 0.87, tx * 0.82)
1109 if (shot == 7) {
1110 a = smooth(53.76, 55.0, ct)
1111 uu = (u + 0.86) / 1.18 + 0.5; vv = (0.24 - v) / (1.18 * 75 / 607) + 0.5
1112 logo = tex(wordmark, uu, vv) * step(0, uu) * step(uu, 1) * step(0, vv) * step(vv, 1) * a
1113 title = letter(printTitle, -1.44, 0.01, 0.18) * a
1114 sub = letter(endline, -1.44, -0.35, 0.052) * a
1115 state = letter(wip, -1.44, -0.69, 0.036) * a
1116 cadd(logo * 0.85 + title * 0.10 + sub * 0.65 + state * 0.45, logo * 0.9 + title * 0.68 + sub * 0.75 + state * 0.59, logo * 0.85 + title * 0.58 + sub * 0.69 + state * 0.54)
1118 cmul(fadeIn)

Click a line number to link to that line.