SKYLINE
skyline.dmt · 100 BPM · 30 s · 960×600
cityproceduralraymarch
notes
A night flight over a procedural neon city, raymarched from one domain-repeated box with hashed heights, windows and rooftop neon.
| music | cinematic: slow kick, industrial clank, growling bass, CS-80 style unison brass through a chan reverb, delayed arp, noise drone |
|---|---|
| visual | raymarched night flight down a street of a procedural city: one domain-repeated box SDF with hashed heights, lit window grids flickering with the arp, rooftop neon, wet street grid, moon and stars, distance fog; rain streaks, bloom and snare chromatic split in post; camera path and rain from the timeline |
| file | skyline.dmt |
|---|---|
| duration | 0:30 |
| video | 960×600 · 30 fps · h264 + audio · 18 MB |
| song | 100 BPM · speed 6 · rpb 4 · 6 channels |
| loop | 0 |
| render | scale 2 · dither on · master 0.6 |
| uniforms | camx camy camz lookd kickE snE arpE rainA fogA |
| collection | Demos |
| tags | cityproceduralraymarch |
| source | 323 lines · 13 KB · download |
anatomy
12VM programs
6patterns
1palettes
26timeline events
0text / sample / texture
323source lines
6inst
2chan
1master
1frame
1pixel
1post
3fn
line composition
pattern 36%pixel 27%inst 12%fn 7%frame 4%post 3%timeline 3%chan 3%palette 2%master 1%title 0%song 0%order 0%pan 0%uniform 0%
play order
0011223342335
order list · 13 entries
palettes
neon4 keys · lines 13–18
timeline
| at | event | value | source | |
|---|---|---|---|---|
| 0:00 | speedk | 0.6 | L21 | |
| 0:00 | height | 3.5 | L21 | |
| 0:00 | look | 0.35 | L21 | |
| 0:00 | rain | 0 | L21 | |
| 0:00 | fog | 1.2 | L21 | |
| 0:05 | speedk | 1.0 | L22 | |
| 0:05 | rain | 0.4 | L22 | |
| 0:10 | height | 2.2 | L23 | |
| 0:10 | look | 0.15 | L23 | |
| 0:10 | rain | 0.8 | L23 | |
| 0:14 | speedk | 1.4 | L24 | |
| 0:14 | height | 4.5 | L24 | |
| 0:14 | look | 0.5 | L24 | |
| 0:19 | speedk | 0.5 | L25 | |
| 0:19 | height | 1.6 | L25 | |
| 0:19 | look | 0.05 | L25 | |
| 0:19 | rain | 1 | L25 | |
| 0:19 | fog | 1.6 | L25 | |
| 0:22 | speedk | 1.2 | L26 | |
| 0:22 | height | 3 | L26 | |
| 0:22 | look | 0.3 | L26 | |
| 0:22 | fog | 1.0 | L26 | |
| 0:29 | speedk | 0.4 | L27 | |
| 0:29 | height | 6 | L27 | |
| 0:29 | look | 0.7 | L27 | |
| 0:29 | rain | 0.2 | L27 |
Event times are derived from the order list, pattern lengths, BPM and RPB. The rendered video is 0:30; the computed song length is 0:31.
resources
No external text, samples, textures or envelopes.
source
1# @description A night flight over a procedural neon city, raymarched from one domain-repeated box with hashed heights, windows and rooftop neon.
2# @tags raymarch, city, procedural
3# @collection Demos
4# @music cinematic: slow kick, industrial clank, growling bass, CS-80 style unison brass through a chan reverb, delayed arp, noise drone
5# @visual raymarched night flight down a street of a procedural city: one domain-repeated box SDF with hashed heights, lit window grids flickering with the arp, rooftop neon, wet street grid, moon and stars, distance fog; rain streaks, bloom and snare chromatic split in post; camera path and rain from the timeline
6# skyline.dmt - night flight over a procedural neon city. Raymarched with repeat; the city is
7# one box SDF domain-repeated on a 2x2 grid with hashed heights, windows and rooftop neon.
8title SKYLINE
9song bpm=100 speed=6 rpb=4 channels=6 loop=0 volume=0.6 scale=2 dither=1
10order 0 0 1 1 2 2 3 3 4 2 3 3 5
11pan 0.5 0.5 0.5 0.4 0.6 0.5
13palette neon {
14 0.00 1.00 0.20 0.60
15 0.33 0.10 0.90 1.00
16 0.66 1.00 0.80 0.20
17 1.00 1.00 0.20 0.60
18}
20timeline {
21 0:00 speedk=0.6 height=3.5 look=0.35 rain=0 fog=1.2
22 2:00 speedk=1.0 rain=0.4
23 4:00 height=2.2 look=0.15 rain=0.8
24 6:00 speedk=1.4 height=4.5 look=0.5
25 8:00 speedk=0.5 height=1.6 look=0.05 rain=1 fog=1.6
26 9:00 speedk=1.2 height=3 look=0.3 fog=1.0
27 12:00 speedk=0.4 height=6 look=0.7 rain=0.2
28}
30inst kick {
31 f = 40 + 300 * exp(-t * 18)
32 $p = $p + f / sr
33 out(dist(sin($p * tau) * exp(-t * 3.5) * 2.2, 1.6) * 0.85)
34}
35inst clank {
36 # industrial snare: noise burst + inharmonic FM metal
37 n = svf(noise(), 1500 + 3000 * exp(-t * 25), 0.4)
38 n = r1 * 0.7 + n * 0.3
39 m = sin(tau * 1370 * t) * 3 * exp(-t * 6)
40 metal = sin(tau * 523 * t + m) * exp(-t * 9)
41 out((n * exp(-t * 10) + metal * 0.5) * 0.6)
42}
43inst bass {
44 e = env(0.01, 0.4, 0.7, 0.3)
45 s = sin(ph * tau) * 0.8 + svf(bsaw(ph, freq) + bsaw(ph + 0.002 * t, freq) * 0.7, 120 + 700 * e * (0.5 + p0), 0.5) * 0.6
46 out(dist(s, 1.3) * e * 0.5)
47}
48inst brass nna=continue {
49 # cs-80 style: slow swell, unison saws, ring resonance
50 e = env(0.5, 1.2, 0.8, 1.2)
51 f = freq * (1 + 0.004 * sin(t * 4.5) * min(t * 0.5, 1))
52 s = usaw(f, 0.2) + usaw(f * 0.5, 0.12) * 0.5
53 s = svf(s, 300 + 1500 * e + 800 * p0, 0.45)
54 s = s + r2 * 0.7
55 out(dist(s * 0.5, 1.2) * e * 0.28)
56}
57inst arp nna=continue {
58 e = env(0.002, 0.25, 0.0, 0.1)
59 s = bsqr(ph, 0.3, freq) * 0.6 + sin(ph * tau * 2) * 0.4 * e
60 s = svf(s, 600 + 3500 * e, 0.4)
61 out(s * e * 0.28)
62}
63inst drone {
64 e = env(1.5, 2.0, 0.9, 3.0)
65 s = svf(noise(), 200 + 150 * sin(t * 0.3), 0.93) * 3 + sin(ph * tau) * 0.4 + sin(ph * tau * 1.5 + 0.1) * 0.25
66 out(s * e * 0.2)
67}
69chan 3 {
70 w = verb(x, 0.9, 0.3)
71 out(x * 0.7 + w * 0.8)
72}
73chan 4 {
74 d = dly(x, 0.45, 0.45)
75 d2 = dly(x, 0.3, 0.3)
76 out(x + d * 0.4 + d2 * 0.25)
77}
78master {
79 w = verb(l * 0.5 + r * 0.5, 0.8, 0.5)
80 out(dist(l + w * 0.15, 1.2), dist(r + w * 0.15, 1.2))
81}
83# channels: 0 kick 1 clank 2 bass 3 brass 4 arp 5 drone key D minor
84pattern 0 rows=16 {
85 . | . | . | . | D-4 5 26 | D-2 6 34
86 . | . | . | . | . | .
87 . | . | . | . | A-4 5 22 | .
88 . | . | . | . | . | .
89 . | . | . | . | F-5 5 24 | .
90 . | . | . | . | . | .
91 . | . | . | . | A-4 5 20 | .
92 . | . | . | . | . | .
93 . | . | . | . | D-5 5 26 | .
94 . | . | . | . | . | .
95 . | . | . | . | A-4 5 22 | .
96 . | . | . | . | . | .
97 . | . | . | . | F-5 5 24 | .
98 . | . | . | . | . | .
99 . | . | . | . | E-5 5 20 | .
100 . | . | . | . | . | .
101}
102pattern 1 rows=16 {
103 C-2 1 40 | . | D-1 3 40 S20 | . | D-4 5 26 | D-2 6 34
104 . | . | . | . | . | .
105 . | . | . | . | A-4 5 22 | .
106 . | . | . | . | . | .
107 . | . | . | . | F-5 5 24 | .
108 . | . | . | . | . | .
109 . | . | D-1 3 30 | . | A-4 5 20 | .
110 . | . | . | . | . | .
111 C-2 1 40 | . | . | . | D-5 5 26 | .
112 . | . | . | . | . | .
113 . | . | . | . | A-4 5 22 | .
114 . | . | . | . | . | .
115 . | C-4 2 36 | A#0 3 40 | . | F-5 5 24 | .
116 . | . | . | . | . | .
117 . | . | C-1 3 40 | . | E-5 5 20 | .
118 . | . | . | . | . | .
119}
120pattern 2 rows=16 {
121 C-2 1 40 | . | D-1 3 40 S50 | D-3 4 30 S30 | D-4 5 26 | D-2 6 34
122 . | . | . | . | . | .
123 . | . | . | F-3 4 26 | A-4 5 22 | .
124 . | . | . | . | . | .
125 . | C-4 2 36 | . | . | F-5 5 24 | .
126 . | . | . | . | . | .
127 . | . | D-1 3 30 | . | A-4 5 20 | .
128 . | . | . | . | . | .
129 C-2 1 40 | . | A#0 3 40 | A#2 4 30 | D-5 5 26 | .
130 . | . | . | . | . | .
131 . | . | . | D-3 4 26 | A-4 5 22 | .
132 . | . | . | . | . | .
133 . | C-4 2 36 | C-1 3 40 | . | F-5 5 24 | .
134 . | . | . | . | . | .
135 . | . | C-1 3 30 | . | G-5 5 20 | .
136 C-2 1 30 | . | . | . | . | .
137}
138pattern 3 rows=16 {
139 C-2 1 40 | . | G-1 3 40 S80 | G-3 4 30 S60 | G-4 5 26 | G-2 6 34
140 . | . | . | . | . | .
141 . | . | . | A#3 4 26 | D-5 5 22 | .
142 . | . | . | . | . | .
143 . | C-4 2 36 | . | . | A#5 5 24 | .
144 . | . | . | . | . | .
145 . | . | G-1 3 30 | . | D-5 5 20 | .
146 . | . | . | . | . | .
147 C-2 1 40 | . | A-1 3 40 | A-3 4 30 | A-4 5 26 | A-2 6 34
148 . | . | . | . | . | .
149 . | . | . | C#4 4 26 | E-5 5 22 | .
150 . | . | . | . | . | .
151 . | C-4 2 36 | A-1 3 40 | . | A-5 5 24 | .
152 . | . | . | . | . | .
153 . | C-4 2 20 | A-1 3 30 | . | G-5 5 20 | .
154 . | C-4 2 30 | . | . | . | .
155}
156pattern 4 rows=16 {
157 # break: brass alone with the drone
158 . | . | . | D-3 4 34 SA0 | . | D-2 6 38
159 . | . | . | . | . | .
160 . | . | . | . | . | .
161 . | . | . | . | . | .
162 . | . | . | A-3 4 30 | . | .
163 . | . | . | . | . | .
164 . | . | . | . | . | .
165 . | . | . | . | . | .
166 . | . | . | A#3 4 34 | . | A#1 6 38
167 . | . | . | . | . | .
168 . | . | . | . | . | .
169 . | . | . | . | . | .
170 . | . | . | A-3 4 30 | . | .
171 . | . | . | . | . | .
172 . | . | . | . | . | .
173 . | . | . | . | . | .
174}
175pattern 5 rows=16 {
176 # outro: long chord, everything releases
177 C-2 1 40 | C-4 2 30 | D-1 3 40 S00 | D-3 4 34 S20 | D-4 5 26 | D-2 6 38
178 . | . | . | . | . | .
179 . | . | . | . | . | .
180 . | . | . | . | . | .
181 . | . | . | . | . | .
182 . | . | . | . | . | .
183 . | . | . | . | . | .
184 . | . | . | . | . | .
185 . | . | off | . | . | .
186 . | . | . | . | . | .
187 . | . | . | . | . | .
188 . | . | . | . | . | .
189 . | . | . | off | . | off
190 . | . | . | . | . | .
191 . | . | . | . | . | .
192 . | . | . | . | . | .
193}
195# ------------------------------------------------------------------ city
196fn box(px, py, pz, bx, by, bz) {
197 qx = abs(px) - bx
198 qy = abs(py) - by
199 qz = abs(pz) - bz
200 return len(len(max(qx, 0), max(qy, 0)), max(qz, 0)) + min(max(qx, max(qy, qz)), 0)
201}
202fn bheight(cx, cz) {
203 hh = hash(cx * 7.31 + cz * 13.77)
204 return (0.6 + 7 * hh ^ 2) * step(0.12, hash(cx * 3.17 + cz * 5.71))
205}
206fn city(px, py, pz) {
207 cx = floor(px / 2 + 0.5)
208 cz = floor(pz / 2 + 0.5)
209 lx = px - cx * 2
210 lz = pz - cz * 2
211 ht = bheight(cx, cz)
212 wd = 0.42 + 0.3 * hash(cx * 1.71 + cz * 2.33)
213 d = box(lx, py - ht * 0.5, lz, wd, ht * 0.5, wd)
214 return min(d, py)
215}
217uniform camx camy camz lookd kickE snE arpE rainA fogA
219frame {
220 kickE = exp(-trig(0) * 7)
221 snE = exp(-trig(1) * 8)
222 arpE = exp(-trig(4) * 9)
223 $z = $z + evtl(speedk) * 0.03
224 camz = $z
225 camx = 1.0 + 0.22 * sin(beat * 0.08) # stay in the street between building columns
226 camy = max(evtl(height), 2.4) + 0.15 * sin(beat * 0.3) + 0.08 * kickE
227 lookd = evtl(look)
228 rainA = evtl(rain)
229 fogA = evtl(fog)
230}
231pixel {
232 # camera: forward +z, tilted down by lookd, slight roll with the sway
233 roll = 0.05 * sin(beat * 0.08)
234 ux = rot(u, v, roll)
235 vy = r1
236 dx = ux
237 dy = vy * 0.85 - lookd
238 dz = 1.4
239 dl = len(len(dx, dz), dy)
240 dx = dx / dl
241 dy = dy / dl
242 dz = dz / dl
243 tt = 0.05
244 d = 1
245 repeat i 56 {
246 px = camx + dx * tt
247 py = camy + dy * tt
248 pz = camz + dz * tt
249 d = city(px, py, pz)
250 tt = tt + d * 0.6 * step(0.003, d)
251 }
252 far = 60
253 hit = step(d, 0.03) * step(tt, far)
254 px = camx + dx * tt
255 py = camy + dy * tt
256 pz = camz + dz * tt
257 e = 0.02
258 nx = city(px + e, py, pz) - city(px - e, py, pz)
259 ny = city(px, py + e, pz) - city(px, py - e, pz)
260 nz = city(px, py, pz + e) - city(px, py, pz - e)
261 nl = len(len(nx, nz), ny) + 0.0001
262 nx = nx / nl
263 ny = ny / nl
264 nz = nz / nl
265 # which cell / building did we hit
266 cx = floor(px / 2 + 0.5)
267 cz = floor(pz / 2 + 0.5)
268 ht = bheight(cx, cz)
269 ground = step(0.5, ny) * step(py, 0.05)
270 side = 1 - ground
271 # windows: grid on the facade, lit by hash, flicker with the arp
272 wall_u = (abs(nx) > abs(nz) ? pz : px) * 5
273 wall_v = py * 4
274 wid = hash(floor(wall_u) * 3.3 + floor(wall_v) * 7.7 + cx * 11 + cz * 17)
275 inwin = step(0.25, fract(wall_u)) * step(fract(wall_u), 0.75) * step(0.3, fract(wall_v)) * step(fract(wall_v), 0.8)
276 lit = step(0.45, wid + 0.25 * arpE * step(0.9, hash(floor(wall_u) + floor(wall_v) * 2 + floor(beat * 2)))) * inwin * side
277 # rooftop neon band
278 neon = side * step(ht - 0.18, py) * step(py, ht - 0.04) * step(0.3, hash(cx * 2.1 + cz * 4.3))
279 pal(neon, hash(cx * 0.37 + cz * 0.71) + bar * 0.01)
280 nr = cget(0)
281 ng = cget(1)
282 nb = cget(2)
283 # shading
284 lx = -0.4
285 ly = 0.7
286 lz = -0.6
287 diff = max(nx * lx + ny * ly + nz * lz, 0)
288 base = 0.04 + 0.06 * diff
289 # ground: wet asphalt with a glowing street grid
290 gx = exp(-abs(fract(px / 2 + 0.5) - 0.5) * 30)
291 gz = exp(-abs(fract(pz / 2 + 0.5) - 0.5) * 30)
292 street = ground * (gx + gz) * 0.6
293 fog = exp(-tt * 0.045 * fogA)
294 cr = (base + lit * 0.9 + neon * nr * 1.6 + street * 0.3) * hit
295 cg = (base * 1.1 + lit * 0.75 + neon * ng * 1.6 + street * 0.6) * hit
296 cb = (base * 1.6 + lit * 0.4 + neon * nb * 1.6 + street * 0.9) * hit
297 # sky: gradient, stars, a big moon
298 sky = 1 - hit
299 skyg = clamp(dy * 2, 0, 1)
300 star = step(0.996, hash(floor(dx * 300) + floor(dy * 300) * 71.3 + floor(dz * 300) * 9.1)) * (0.5 + 0.5 * sin(beat * 2 + hash(floor(dx * 300)) * 20))
301 moon = 1 - smooth(0.06, 0.07, len(dx - 0.35, dy - 0.3))
302 moonglow = exp(-len(dx - 0.35, dy - 0.3) * 6) * 0.3
303 cr = cr + sky * (0.03 + 0.05 * (1 - skyg) + star * 0.9 + moon * 0.9 + moonglow * 0.6)
304 cg = cg + sky * (0.02 + 0.04 * (1 - skyg) + star * 0.9 + moon * 0.85 + moonglow * 0.5)
305 cb = cb + sky * (0.08 + 0.12 * (1 - skyg) + star + moon * 0.7 + moonglow * 0.7)
306 # distance fog toward the sky colour
307 fr = 0.03
308 fg = 0.03
309 fb = 0.09
310 rgb(mix(fr, cr, fog * hit + sky), mix(fg, cg, fog * hit + sky), mix(fb, cb, fog * hit + sky))
311 cmul(1 + 0.25 * kickE)
312 cprev(x, y, 0.15)
313}
314post {
315 # bloom, rain streaks, chromatic split on the snare, vignette
316 b = tap(-2, 0) + tap(2, 0) + tap(0, -2) + tap(0, 2) + tap(-3, -3) + tap(3, 3) + tap(-3, 3) + tap(3, -3)
317 bl = b * 0.125
318 rain = step(0.985, hash(floor(x * 180 + y * 12) * 1.7 + floor(y * 6 - time * 9))) * rainA * 0.25
319 rs = tap(-1 - floor(2 * snE), 0)
320 rgb(mix(cget(0), rs, 0.5) + bl * 0.3 + rain, cget(1) + bl * 0.3 + rain, cget(2) + bl * 0.4 + rain * 1.2)
321 d = len(u, v)
322 cmul(1 - 0.35 * d * d)
323}
Click a line number to link to that line.