CARNIVAL
carnival.dmt · 120 BPM · 36 s · 960×600
model-madecinematic
notes
A waltz for a fairground that is a little too quiet: a lantern-lit carnival under a moon with a painted face, a match cut into that face, then back for the last dance.
| music | 3/4 waltz: tuba, chord-generating calliope, music-box FM, theremin, soft kick, brushes and harmonium drone through modulated delays and Freeverb |
|---|---|
| visual | a night fairground reflected in a wet plaza under a moon with a face: tents, a Ferris wheel and lantern strings, then a match cut into a cracked plaster mask with a tiny fair inside its eyes, a widening grin and a tear, then back to the fair for the confetti finale and title; scale=2 dither=1 |
| file | carnival.dmt |
|---|---|
| duration | 0:36 |
| video | 960×600 · 30 fps · h264 + audio · 10 MB |
| song | 120 BPM · speed 6 · rpb 4 · 7 channels |
| loop | 0 |
| render | scale 2 · dither on · master 0.55 |
| uniforms | zoom camx camy roll glow faceA smile eye titleA scn flash conf warp wheelA kickE |
| model | DeepSeek V4.1 Flash |
| collection | Written by the models |
| tags | model-madecinematic |
| source | 861 lines · 34 KB · download |
anatomy
13VM programs
14patterns
0palettes
59timeline events
1text / sample / texture
861source lines
8inst
0chan
1master
1frame
2pixel
1post
4fn
line composition
pixel 46%pattern 24%fn 13%inst 7%timeline 3%frame 3%post 2%master 1%title 0%song 0%order 0%pan 0%uniform 0%text 0%
play order
012345623457788991011910111213
order list · 24 entries
timeline
| at | event | value | source | |
|---|---|---|---|---|
| 0:00 | scn | 0 | L307 | |
| 0:00 | glow | 0.12 | L307 | |
| 0:00 | faceA | 0.00 | L307 | |
| 0:00 | smile | 0.15 | L307 | |
| 0:00 | eye | 0.95 | L307 | |
| 0:00 | titleA | 1.0 | L307 | |
| 0:00 | conf | 0.0 | L307 | |
| 0:00 | warp | 0.0 | L307 | |
| 0:02 | glow | 0.22 | L309 | |
| 0:03 | titleA | 0.0 | L308 | |
| 0:03 | glow | 0.38 | L310 | |
| 0:03 | faceA | 0.16 | L310 | |
| 0:05 | glow | 0.52 | L311 | |
| 0:08 | faceA | 0.24 | L312 | |
| 0:12 | glow | 0.66 | L313 | |
| 0:12 | faceA | 0.30 | L313 | |
| 0:15 | glow | 0.74 | L314 | |
| 0:15 | faceA | 0.36 | L314 | |
| 0:15 | warp | 0.0 | L314 | |
| 0:17 | scn | 1 | L315 | |
| 0:17 | smile | 0.30 | L315 | |
| 0:17 | eye | 0.05 | L315 | |
| 0:17 | titleA | 0.0 | L315 | |
| 0:17 | warp | 0.35 | L315 | |
| 0:17 | smile | 0.38 | L316 | |
| 0:17 | eye | 0.45 | L316 | |
| 0:18 | eye | 0.90 | L317 | |
| 0:18 | smile | 0.50 | L317 | |
| 0:20 | eye | 1.00 | L318 | |
| 0:20 | smile | 0.62 | L318 | |
| 0:20 | eye | 0.06 | L319 | |
| 0:21 | eye | 1.05 | L320 | |
| 0:21 | smile | 0.78 | L320 | |
| 0:21 | eye | 0.38 | L321 | |
| 0:21 | smile | 0.94 | L321 | |
| 0:22 | eye | 1.15 | L322 | |
| 0:22 | smile | 1.10 | L322 | |
| 0:22 | warp | 0.90 | L322 | |
| 0:22 | conf | 0.0 | L322 | |
| 0:23 | scn | 0 | L323 | |
| 0:23 | glow | 0.82 | L323 | |
| 0:23 | faceA | 0.55 | L323 | |
| 0:23 | smile | 0.60 | L323 | |
| 0:23 | eye | 1.00 | L323 | |
| 0:23 | conf | 0.25 | L323 | |
| 0:23 | warp | 0.00 | L323 | |
| 0:26 | glow | 1.00 | L324 | |
| 0:26 | conf | 0.55 | L324 | |
| 0:29 | glow | 1.15 | L325 | |
| 0:29 | conf | 0.90 | L325 | |
| 0:32 | glow | 1.02 | L326 | |
| 0:32 | titleA | 0.0 | L326 | |
| 0:32 | titleA | 0.85 | L327 | |
| 0:33 | titleA | 1.00 | L328 | |
| 0:33 | conf | 0.65 | L328 | |
| 0:35 | glow | 0.82 | L329 | |
| 0:35 | titleA | 1.00 | L329 | |
| 0:35 | conf | 0.20 | L329 | |
| 0:36 | glow | 0.66 | L330 |
Event times are derived from the order list, pattern lengths, BPM and RPB.
resources
| kind | name | info | value |
|---|---|---|---|
| text | ttitle | 8 | CARNIVAL |
source
1# @description A waltz for a fairground that is a little too quiet: a lantern-lit carnival under a moon with a painted face, a match cut into that face, then back for the last dance.
2# @tags cinematic
3# @model DeepSeek V4.1 Flash
4# @collection Written by the models
5# @music 3/4 waltz: tuba, chord-generating calliope, music-box FM, theremin, soft kick, brushes and harmonium drone through modulated delays and Freeverb
6# @visual a night fairground reflected in a wet plaza under a moon with a face: tents, a Ferris wheel and lantern strings, then a match cut into a cracked plaster mask with a tiny fair inside its eyes, a widening grin and a tear, then back to the fair for the confetti finale and title; scale=2 dither=1
7# @duration 36
8# carnival.dmt - a waltz for a fairground that is a little too quiet.
9# A wide shot of a lantern-lit carnival under a moon with a painted face,
10# a match cut into that face during the bridge, then back for the last dance.
11title CARNIVAL
12song bpm=120 speed=6 rpb=4 channels=7 loop=0 volume=0.55 scale=2 dither=1
13order 0 1 2 3 4 5 6 2 3 4 5 7 7 8 8 9 9 10 11 9 10 11 12 13
14pan 0.50 0.46 0.58 0.40 0.50 0.62 0.50
16text ttitle "CARNIVAL"
18# ------------------------------------------------------------------ instruments
19# a soft tuba for the oom of the waltz
20inst tuba {
21 e = env(0.004, 0.10, 0.45, 0.14)
22 s = sin(ph * tau) * 0.95 + tri(ph * 2.0) * 0.15 + saw(ph) * 0.18
23 s = lp(s, 180 + 700 * e * e)
24 out(dist(s * e * 1.2, 1.4) * 0.52)
25}
26# steam calliope: root + third (p0 picks major) + fifth, slightly sharp
27inst calliope {
28 e = env(0.018, 0.09, 0.55, 0.16)
29 third = 1.1892 + 0.0702 * p0
30 s = usaw(freq, 0.075) * 0.55
31 s = s + usaw(freq * third, 0.095) * 0.34
32 s = s + usaw(freq * 1.4983, 0.12) * 0.28
33 s = s + sin(ph * tau + 0.06 * sin(t * 5.1)) * 0.40
34 s = svf(s, 380 + 1600 * e + 260 * sin(t * 7.3), 0.22)
35 s = s * (0.82 + 0.18 * sin(t * tau * 6.2))
36 out(dist(s * e * 1.1, 1.5) * 0.24)
37}
38# a music box with a worn comb
39inst musicbox {
40 e = exp(-t * 2.4)
41 m = sin(ph * tau * 3.01 + 0.5 * sin(t * 2.7)) * exp(-t * 4.2)
42 s = sin(ph * tau + m * 1.25) + 0.30 * sin(ph * tau * 2.005)
43 click = hp(noise(), 3800) * exp(-t * 160) * 0.18
44 out((s * e + click) * 0.22)
45}
46# the thing that sings in the bridge
47inst theremin nna=continue {
48 e = env(0.28, 0.35, 0.80, 0.45)
49 v = 0.22 * sin(t * 5.7) + 0.08 * sin(t * 2.1)
50 s = sin(ph * tau + v) + 0.16 * sin(ph * tau * 2.002 - v * 1.4)
51 s = svf(s, 1100 + 900 * e, 0.40)
52 out(s * e * 0.20)
53}
54inst kick {
55 f = 52 + 220 * exp(-t * 28)
56 $p = $p + f / sr
57 body = sin($p * tau) * exp(-t * 8)
58 thump = sin($p * tau * 2.01) * exp(-t * 22) * 0.20
59 click = lp(noise(), 1500) * exp(-t * 110) * 0.18
60 out(dist((body + thump + click) * 1.35, 1.25) * 0.62)
61}
62# brushes on a snare, played as a whisper
63inst brush {
64 e = exp(-t * (7 + 5 * (1 - vel)))
65 n = svf(noise(), 1800 + 2400 * vel, 0.5)
66 body = sin(tau * 197 * t) * exp(-t * 26) * 0.18
67 out((n * 0.9 + body) * e * 0.30)
68}
69inst chime {
70 e = exp(-t * 1.35)
71 m = sin(ph * tau * 2.76 + 0.4) * 2.0 * exp(-t * 2.0)
72 s = sin(ph * tau + m) + 0.28 * sin(ph * tau * 3.01)
73 out(s * e * 0.17)
74}
75# a low harmonium drone that never quite settles
76inst drone nna=continue {
77 e = env(1.2, 1.4, 0.80, 1.8)
78 s = usaw(freq * 0.5, 0.22) * 0.35 + sin(ph * tau * 0.5) * 0.55 + sin(ph * tau) * 0.22
79 s = svf(s, 150 + 180 * sin(t * 0.17) + 260 * p0, 0.22)
80 out(s * e * 0.20)
81}
83master {
84 # short modulated delays: a seasick chorus on the whole fairground
85 cl = dly(l, 0.013 + 0.0035 * sin(t * 0.63), 0.0)
86 cr = dly(r, 0.017 + 0.0040 * sin(t * 0.71 + 1.7), 0.0)
87 dl = dly(l + cr * 0.25, 0.371, 0.40)
88 dr = dly(r + cl * 0.25, 0.487, 0.40)
89 w = verb(l * 0.5 + r * 0.5, 0.84, 0.50)
90 out(dist(l * 0.90 + cl * 0.22 + dr * 0.18 + w * 0.18, 1.10),
91 dist(r * 0.90 + cr * 0.22 + dl * 0.18 + w * 0.18, 1.10))
92}
94# ------------------------------------------------------------------ 0: first light
95pattern 0 rows=12 {
96 00: . | . | D-6 3 24 ... | . | . | . | D-2 7 26 ...
97 01: . | . | . | . | . | . | .
98 02: . | . | . | . | . | . | .
99 03: . | . | . | . | . | . | .
100 04: . | . | . | . | . | . | A-2 7 20 ...
101 05: . | . | . | . | . | . | .
102 06: . | . | . | . | . | . | .
103 07: . | . | . | . | . | . | .
104 08: . | . | A-5 3 20 ... | . | . | C-6 6 10 ... | .
105 09: . | . | . | . | . | . | .
106 10: . | . | . | . | . | . | .
107 11: . | . | . | . | . | . | .
108}
109# ------------------------------------------------------------------ 1: the gate opens
110pattern 1 rows=12 {
111 00: D-2 1 26 ... | D-4 2 14 S00 | D-5 3 24 ... | . | C-2 4 14 ... | . | D-2 7 22 ...
112 01: . | . | . | . | . | . | .
113 02: . | . | . | . | . | . | .
114 03: . | . | . | . | . | . | .
115 04: . | D-4 2 12 S00 | . | . | . | C-5 6 12 ... | .
116 05: . | . | . | . | . | . | .
117 06: . | . | . | . | . | . | .
118 07: . | . | . | . | . | . | .
119 08: A-1 1 22 ... | D-4 2 14 S00 | A-5 3 20 ... | . | . | C-5 6 10 ... | .
120 09: . | . | . | . | . | . | .
121 10: . | . | . | . | . | . | .
122 11: . | . | . | . | . | . | .
123}
124# ------------------------------------------------------------------ 2: Dm, the waltz
125pattern 2 rows=12 {
126 00: D-2 1 36 ... | D-4 2 20 S00 | D-5 3 26 ... | . | C-2 4 20 ... | . | .
127 01: . | . | . | . | . | . | .
128 02: . | . | . | . | . | . | .
129 03: . | . | . | . | . | . | .
130 04: . | D-4 2 18 S00 | F-5 3 22 ... | . | . | C-5 6 15 ... | .
131 05: . | . | . | . | . | . | .
132 06: . | . | A-5 3 20 ... | . | . | . | .
133 07: . | . | . | . | . | . | .
134 08: A-1 1 30 ... | D-4 2 20 S00 | D-6 3 22 ... | . | . | C-5 6 13 ... | .
135 09: . | . | . | . | . | . | .
136 10: . | . | C-6 3 17 ... | . | . | . | .
137 11: . | . | . | . | . | . | .
138}
139# ------------------------------------------------------------------ 3: Gm
140pattern 3 rows=12 {
141 00: G-2 1 36 ... | G-4 2 20 S00 | G-5 3 26 ... | . | C-2 4 20 ... | . | .
142 01: . | . | . | . | . | . | .
143 02: . | . | . | . | . | . | .
144 03: . | . | . | . | . | . | .
145 04: . | G-4 2 18 S00 | A#5 3 22 ... | . | . | C-5 6 15 ... | .
146 05: . | . | . | . | . | . | .
147 06: . | . | D-6 3 20 ... | . | . | . | .
148 07: . | . | . | . | . | . | .
149 08: D-2 1 30 ... | G-4 2 20 S00 | G-6 3 20 ... | . | . | C-5 6 13 ... | .
150 09: . | . | . | . | . | . | .
151 10: . | . | F-6 3 17 ... | . | . | . | .
152 11: . | . | . | . | . | . | .
153}
154# ------------------------------------------------------------------ 4: A7
155pattern 4 rows=12 {
156 00: A-2 1 36 ... | A-4 2 20 SFF | A-5 3 26 ... | . | C-2 4 20 ... | . | .
157 01: . | . | . | . | . | . | .
158 02: . | . | . | . | . | . | .
159 03: . | . | . | . | . | . | .
160 04: . | A-4 2 18 SFF | C#6 3 22 ... | . | . | C-5 6 15 ... | .
161 05: . | . | . | . | . | . | .
162 06: . | . | E-6 3 20 ... | . | . | . | .
163 07: . | . | . | . | . | . | .
164 08: E-2 1 30 ... | A-4 2 20 SFF | A-6 3 19 ... | . | . | C-5 6 13 ... | .
165 09: . | . | . | . | . | . | .
166 10: . | . | G-6 3 16 ... | . | . | . | .
167 11: . | . | . | . | . | . | .
168}
169# ------------------------------------------------------------------ 5: Dm, answer
170pattern 5 rows=12 {
171 00: D-2 1 36 ... | D-4 2 20 S00 | D-6 3 24 ... | . | C-2 4 20 ... | . | .
172 01: . | . | . | . | . | . | .
173 02: . | . | A-5 3 19 ... | . | . | . | .
174 03: . | . | . | . | . | . | .
175 04: . | D-4 2 18 S00 | F-5 3 22 ... | . | . | C-5 6 15 ... | .
176 05: . | . | . | . | . | . | .
177 06: . | . | E-5 3 19 ... | . | . | . | .
178 07: . | . | . | . | . | . | .
179 08: A-1 1 30 ... | D-4 2 20 S00 | D-5 3 20 ... | . | . | C-5 6 13 ... | .
180 09: . | . | . | . | . | . | .
181 10: . | . | F-5 3 17 ... | . | . | . | .
182 11: . | . | . | . | . | . | .
183}
184# ------------------------------------------------------------------ 6: build
185pattern 6 rows=12 {
186 00: D-2 1 38 ... | D-4 2 22 S00 | D-6 3 26 ... | . | C-2 4 26 ... | . | .
187 01: . | . | . | . | . | . | .
188 02: . | . | F-6 3 19 ... | . | C-2 4 12 ... | . | .
189 03: . | . | . | . | . | C-6 6 13 ... | .
190 04: . | D-4 2 20 S00 | A-6 3 22 ... | . | . | . | .
191 05: . | . | . | . | . | . | .
192 06: . | . | G-6 3 19 ... | . | C-2 4 12 ... | C-6 6 11 ... | .
193 07: . | . | . | . | . | . | .
194 08: A-1 1 34 ... | D-4 2 22 S00 | F-6 3 20 ... | . | . | . | .
195 09: . | . | . | . | . | . | .
196 10: . | . | D-6 3 18 ... | . | C-2 4 14 ... | C-6 6 11 ... | .
197 11: . | . | . | . | . | . | .
198}
199# ------------------------------------------------------------------ 7: the mask leans in
200pattern 7 rows=12 {
201 00: D-2 1 30 ... | . | D-6 3 18 ... | A-5 4 26 ... | C-2 4 16 ... | . | D-2 7 22 ...
202 01: . | . | . | . | . | . | .
203 02: . | . | C#6 3 14 ... | . | . | . | .
204 03: . | . | . | . | . | . | .
205 04: . | . | C-6 3 13 ... | . | . | . | .
206 05: . | . | . | . | . | . | .
207 06: . | . | A#5 3 12 ... | . | . | . | .
208 07: . | . | . | . | . | . | .
209 08: . | . | A-5 3 12 ... | F-5 4 24 305 | . | . | A-2 7 18 ...
210 09: . | . | . | . | . | . | .
211 10: . | . | G#5 3 10 ... | . | . | . | .
212 11: . | . | . | . | . | . | .
213}
214# ------------------------------------------------------------------ 8: the wrong key
215pattern 8 rows=12 {
216 00: D-2 1 32 ... | D-4 2 16 S00 | D-6 3 18 ... | D-6 4 28 ... | C-2 4 18 ... | . | D-2 7 22 ...
217 01: . | . | . | . | . | . | .
218 02: . | . | . | . | . | . | .
219 03: D#2 1 30 ... | . | C-6 3 12 ... | . | . | . | .
220 04: . | . | . | . | . | . | .
221 05: . | . | . | . | . | . | .
222 06: E-2 1 30 ... | E-4 2 14 S00 | A#5 3 12 ... | A-5 4 26 304 | . | C-5 6 9 ... | .
223 07: . | . | . | . | . | . | .
224 08: . | . | . | . | . | . | .
225 09: F-2 1 30 ... | F-4 2 14 SFF | A-5 3 10 ... | . | . | . | E-2 7 16 ...
226 10: . | . | . | . | . | . | .
227 11: . | . | . | off | . | . | .
228}
229# ------------------------------------------------------------------ 9: climax, Dm
230pattern 9 rows=12 {
231 00: D-2 1 40 ... | D-4 2 24 S00 | D-6 3 28 ... | . | C-2 4 28 ... | C-5 6 18 ... | D-2 7 24 ...
232 01: . | . | . | . | . | . | .
233 02: . | . | A-6 3 21 ... | . | C-2 4 12 ... | . | .
234 03: . | . | . | . | . | . | .
235 04: . | D-4 2 22 S00 | F-6 3 24 ... | . | . | C-5 6 20 ... | .
236 05: . | . | . | . | . | . | .
237 06: . | . | A-6 3 21 ... | . | C-2 4 12 ... | C-6 6 13 ... | .
238 07: . | . | . | . | . | . | .
239 08: A-1 1 36 ... | D-4 2 24 S00 | D-7 3 22 ... | . | C-2 4 22 ... | C-5 6 18 ... | .
240 09: . | . | . | . | . | . | .
241 10: . | . | E-6 3 19 ... | . | . | C-6 6 15 ... | .
242 11: . | . | . | . | . | . | .
243}
244# ------------------------------------------------------------------ 10: climax, Gm
245pattern 10 rows=12 {
246 00: G-2 1 40 ... | G-4 2 24 S00 | G-6 3 28 ... | . | C-2 4 28 ... | C-5 6 18 ... | .
247 01: . | . | . | . | . | . | .
248 02: . | . | D-7 3 19 ... | . | C-2 4 12 ... | . | .
249 03: . | . | . | . | . | . | .
250 04: . | G-4 2 22 S00 | A#6 3 24 ... | . | . | C-5 6 20 ... | .
251 05: . | . | . | . | . | . | .
252 06: . | . | D-7 3 19 ... | . | C-2 4 12 ... | C-6 6 13 ... | .
253 07: . | . | . | . | . | . | .
254 08: D-2 1 36 ... | G-4 2 24 S00 | G-6 3 20 ... | . | C-2 4 22 ... | C-5 6 18 ... | .
255 09: . | . | . | . | . | . | .
256 10: . | . | A#6 3 17 ... | . | . | C-6 6 15 ... | .
257 11: . | . | . | . | . | . | .
258}
259# ------------------------------------------------------------------ 11: climax, A7
260pattern 11 rows=12 {
261 00: A-2 1 40 ... | A-4 2 24 SFF | A-6 3 28 ... | . | C-2 4 28 ... | C-5 6 18 ... | .
262 01: . | . | . | . | . | . | .
263 02: . | . | C#6 3 19 ... | . | C-2 4 12 ... | . | .
264 03: . | . | . | . | . | . | .
265 04: . | A-4 2 22 SFF | E-6 3 24 ... | . | . | C-5 6 20 ... | .
266 05: . | . | . | . | . | . | .
267 06: . | . | C#6 3 19 ... | . | C-2 4 12 ... | C-6 6 13 ... | .
268 07: . | . | . | . | . | . | .
269 08: E-2 1 36 ... | A-4 2 24 SFF | A-6 3 20 ... | . | C-2 4 22 ... | C-5 6 18 ... | .
270 09: . | . | . | . | . | . | .
271 10: . | . | E-6 3 17 ... | . | . | C-6 6 15 ... | .
272 11: . | . | . | . | . | . | .
273}
274# ------------------------------------------------------------------ 12: last chord
275pattern 12 rows=12 {
276 00: D-2 1 34 ... | D-4 2 22 S00 | D-6 3 24 ... | . | C-2 4 24 ... | . | D-2 7 24 ...
277 01: . | . | . | . | . | . | .
278 02: . | . | . | . | . | . | .
279 03: . | . | . | . | . | . | .
280 04: . | D-4 2 18 S00 | F-6 3 18 ... | . | . | . | A-2 7 18 ...
281 05: . | . | . | . | . | . | .
282 06: . | . | . | . | . | . | .
283 07: . | . | . | . | . | . | .
284 08: . | off | A-6 3 16 ... | . | . | C-6 6 14 ... | .
285 09: . | . | . | . | . | . | .
286 10: off | . | D-7 3 14 ... | . | . | . | off
287 11: . | . | . | . | . | . | .
288}
289# ------------------------------------------------------------------ 13: ringing out
290pattern 13 rows=12 {
291 00: . | . | D-6 3 16 ... | . | . | . | .
292 01: . | . | . | . | . | . | .
293 02: . | . | . | . | . | . | .
294 03: . | . | . | . | . | . | .
295 04: . | . | . | . | . | C-6 6 12 ... | .
296 05: . | . | . | . | . | . | .
297 06: . | . | . | . | . | . | .
298 07: . | . | . | . | . | . | .
299 08: . | . | A-6 3 14 ... | . | . | C-6 6 10 ... | .
300 09: . | . | . | . | . | . | .
301 10: . | . | . | . | . | . | .
302 11: . | . | D-7 3 12 ... | . | . | . | .
303}
305# ------------------------------------------------------------------ timeline
306timeline {
307 0:00 scn=0 glow=0.12 faceA=0.00 smile=0.15 eye=0.95 titleA=1.0 conf=0.0 warp=0.0
308 2:00 titleA=0.0
309 1:00 glow=0.22
310 2:00 glow=0.38 faceA=0.16
311 3:00 glow=0.52
312 5:00 faceA=0.24
313 8:00 glow=0.66 faceA=0.30
314 10:00 glow=0.74 faceA=0.36 warp=0.0
315 11:00 scn=1 smile=0.30 eye=0.05 titleA=0.0 warp=0.35
316 11:06 smile=0.38 eye=0.45
317 12:00 eye=0.90 smile=0.50
318 13:00 eye=1.00 smile=0.62
319 13:06 eye=0.06
320 13:09 eye=1.05 smile=0.78
321 14:00 eye=0.38 smile=0.94
322 14:06 eye=1.15 smile=1.10 warp=0.90 conf=0.0
323 15:00 scn=0 glow=0.82 faceA=0.55 smile=0.60 eye=1.00 conf=0.25 warp=0.00
324 17:00 glow=1.00 conf=0.55
325 19:00 glow=1.15 conf=0.90
326 21:00 glow=1.02 titleA=0.0
327 21:04 titleA=0.85
328 22:00 titleA=1.00 conf=0.65
329 23:00 glow=0.82 titleA=1.00 conf=0.20
330 23:08 glow=0.66
331}
333# ------------------------------------------------------------------ visual helpers
334uniform zoom camx camy roll glow faceA smile eye titleA scn flash conf warp wheelA kickE
336fn word(s, py, sz, a, xo) {
337 # centred banner type with a slow hand-painted wobble
338 n = strlen(s)
339 cx = (u - xo + n * sz * 0.5) / sz
340 cy = (py - v + 0.012 * sin(cx * 1.1 + time * 1.7)) / sz
341 i = floor(cx)
342 g = glyph(str(s, i), fract(cx), fract(cy))
343 return g * a * step(0.0, cx) * step(cx, n) * step(0.0, cy) * step(cy, 1.0)
344}
346fn tent(px, py, cx, w, eave, apex, base, seed) {
347 # a striped big top with bulbs on the seams and a lit doorway
348 bx = px - cx
349 ry = (py - eave) / max(apex - eave, 0.001)
350 halfw = w * 0.5 * (1.0 - ry)
351 roof = step(0.0, ry) * step(ry, 1.0) * step(abs(bx), halfw)
352 wall = step(base, py) * step(py, eave) * step(abs(bx), w * 0.42)
353 m = max(roof, wall)
354 sf = fract(bx / (w * 0.105) + seed)
355 stp = step(0.5, sf)
356 pr = mix(0.50, 0.88, stp)
357 pg = mix(0.055, 0.66, stp)
358 pb = mix(0.070, 0.44, stp)
359 sh = 0.42 + 0.58 * clamp(0.5 - bx / w, 0.0, 1.0)
360 pr = pr * sh
361 pg = pg * sh
362 pb = pb * sh
363 rimm = exp(-abs(abs(bx) - halfw) * 60.0) * roof
364 pr = pr * (1.0 - 0.55 * rimm)
365 pg = pg * (1.0 - 0.55 * rimm)
366 pb = pb * (1.0 - 0.55 * rimm)
367 wsf = 0.5 + 0.5 * sin(bx / (w * 0.05) * pi)
368 wr = 0.15 + 0.08 * wsf
369 wg = 0.032 + 0.022 * wsf
370 wb = 0.038 + 0.024 * wsf
371 fr = pr * roof + wr * wall
372 fg = pg * roof + wg * wall
373 fb = pb * roof + wb * wall
374 # cream valance at the eave
375 val = step(py, eave) * step(eave - 0.030, py) * step(abs(bx), w * 0.46)
376 fr = mix(fr, 0.80, val)
377 fg = mix(fg, 0.62, val)
378 fb = mix(fb, 0.38, val)
379 cmul(1.0 - m)
380 cadd(fr * m, fg * m, fb * m)
381 ad = len(bx / (w * 0.100), (py - (base + w * 0.13)) / (w * 0.140))
382 door = (1.0 - smooth(0.55, 0.92, ad)) * wall
383 cmul(1.0 - 0.90 * door)
384 ring = exp(-abs(ad - 1.0) * 14.0) * wall
385 cadd(ring * 1.20, ring * 0.55, ring * 0.15)
386 el = exp(-abs(py - eave) * 150.0) * step(abs(bx), w * 0.46)
387 cadd(el * 0.50, el * 0.34, el * 0.14)
388 bedge = exp(-abs(abs(bx) - halfw) * 70.0) * roof
389 bd2 = step(0.30, sin(bx * 190.0 + time * 2.2 + seed * 6.0))
390 bulb = bedge * bd2
391 cadd(bulb * 1.25, bulb * 0.78, bulb * 0.34)
392 # a pennant on the peak
393 fgx = px - (cx + 0.018 * sin(time * 1.9 + seed))
394 fgy = py - (apex + 0.022)
395 pole = exp(-abs(fgx) * 260.0) * step(0.0, fgy) * step(fgy, 0.075)
396 flag = step(0.0, fgy) * step(fgy, 0.052) * step(abs(fgx), 0.048 * (1.0 - fgy / 0.052))
397 cadd(pole * 0.35, pole * 0.30, pole * 0.22)
398 cadd(flag * 0.70, flag * 0.16, flag * 0.15)
399}
401fn lantstring(px, py, y0, sag, sp, sz, seed, bright) {
402 # a whole catenary of paper lanterns in one evaluation
403 u01 = clamp((px + 1.75) / 3.5, 0.0, 1.0)
404 wy = y0 - sag * sin(pi * u01)
405 lx = (px + 1.75) / sp
406 id = floor(lx)
407 sxp = (id + 0.5 + 0.10 * (hash(id * 3.17 + seed) - 0.5)) * sp - 1.75
408 wi = clamp((sxp + 1.75) / 3.5, 0.0, 1.0)
409 wy2 = y0 - sag * sin(pi * wi)
410 szz = sz * (0.78 + 0.44 * hash(id * 5.13 + seed + 2.0))
411 sway = 0.012 * sin(time * 0.9 + id * 1.7)
412 ddx = px - sxp
413 ddy = py - (wy2 - szz * 1.05 + sway)
414 d = len(ddx, ddy * 1.18)
415 body = 1.0 - smooth(szz * 0.78, szz, d)
416 glow = exp(-d * 24.0) * 0.26 + exp(-d * 6.0) * 0.040
417 rib = 0.70 + 0.30 * cos(ddx / max(szz, 0.001) * pi * 2.0)
418 fl = 0.85 + 0.15 * sin(time * 2.7 + id * 2.3) + 0.10 * bright
419 cadd((glow + body * 0.85 * rib) * bright * fl,
420 (glow * 0.40 + body * 0.50 * rib) * bright * fl,
421 (glow * 0.11 + body * 0.15 * rib) * bright * fl)
422 wire = exp(-abs(py - wy) * 420.0) * 0.08 * bright
423 cadd(wire, wire * 0.8, wire * 0.5)
424}
426fn crowd(px, py, base, hmin, hmax, cnt, seed, dark) {
427 cg = (px + 1.7) * (cnt / 3.4)
428 id = floor(cg)
429 fx = (fract(cg) - 0.5) * (3.4 / cnt) + (hash(id * 2.11 + seed) - 0.5) * (0.55 / cnt)
430 hh = hmin + (hmax - hmin) * hash(id * 7.31 + seed)
431 hh = hh * (1.0 + 0.30 * step(0.93, hash(id * 13.7 + seed)))
432 by = base + 0.04 * hash(id * 3.77 + seed)
433 sw = 0.008 * sin(time * 0.9 + id * 2.1)
434 hd = len((fx - sw) / (hh * 0.20), (py - (by + hh + hh * 0.20)) / (hh * 0.22))
435 head = 1.0 - smooth(0.80, 1.0, hd)
436 body = 1.0 - smooth(0.78, 1.0, len(fx / (hh * 0.52), (py - (by + hh * 0.48)) / (hh * 0.56)))
437 sil = max(head, body)
438 sil = sil * step(0.10, hash(id * 11.3 + seed))
439 cmul(1.0 - sil * dark)
440}
442# ------------------------------------------------------------------ frame
443frame {
444 glowT = evtl(glow)
445 glow = glowT * (0.88 + 0.12 * sin(time * 0.73)) + 0.28 * cenv(1) + 0.10 * cenv(0)
446 faceA = evtl(faceA)
447 smile = evtl(smile)
448 eye = evtl(eye)
449 titleA = evtl(titleA)
450 conf = evtl(conf)
451 warp = evtl(warp)
452 kickE = exp(-trig(4) * 9.0) * step(0.40, vel(4))
453 prog = clamp(lbeat / max(llen, 1.0), 0.0, 1.0)
454 zoom = 1.0 + 0.15 * prog + 0.012 * kickE
455 camx = 0.035 * prog + 0.012 * sin(time * 0.13)
456 camy = -0.010 * prog + 0.008 * sin(time * 0.19)
457 roll = 0.010 * sin(time * 0.11) + 0.004 * sin(beat * 0.5)
458 wheelA = time * 0.20 + 0.06 * sin(time * 0.07)
459 scn = evt(scn)
460 ps = $scn
461 $scn = scn
462 cut = step(0.5, abs(scn - ps))
463 flash = max(cut, flash * 0.70)
464 select(scn)
465}
467# ------------------------------------------------------------------ the fairground
468pixel fair {
469 prog = clamp(lbeat / max(llen, 1.0), 0.0, 1.0)
470 zz = zoom * (1.0 + 0.004 * sin(time * 0.9) + 0.014 * kickE)
471 qx = rot(u, v, roll + 0.012 * sin(time * 0.17)) * zz + camx + 0.05 * warp * sin(v * 4.0 + time * 0.7)
472 qy = r1 * zz + camy + 0.04 * warp * sin(u * 5.0 - time * 0.6)
474 # ---------------- wet ground mirrors everything above the horizon
475 hor = -0.18
476 gnd = step(qy, hor)
477 rr = hor - qy
478 qx = qx + gnd * (0.020 * sin(qy * 17.0 + time * 1.1) + 0.009 * sin(qy * 37.0 - time * 1.9)) * smooth(0.02, 0.22, rr)
479 rip = (0.011 * sin(qx * 5.5 + time * 1.2) + 0.005 * sin(qx * 15.0 - time * 2.0)) * smooth(0.0, 0.10, rr)
480 sy = mix(qy, 2.0 * hor - qy, gnd) + rip * gnd
482 # ---------------- sky: indigo night over a narrow ember sunset
483 hgt = clamp((sy - hor) * 0.72, 0.0, 1.0)
484 skyR = mix(mix(0.30, 0.052, smooth(0.0, 0.30, hgt)), 0.006, smooth(0.30, 1.0, hgt))
485 skyG = mix(mix(0.095, 0.020, smooth(0.0, 0.30, hgt)), 0.008, smooth(0.30, 1.0, hgt))
486 skyB = mix(mix(0.060, 0.062, smooth(0.0, 0.30, hgt)), 0.028, smooth(0.30, 1.0, hgt))
487 bnd = exp(-max(0.0, sy - hor) * 13.0) * (0.35 + 0.65 * glow)
488 skyR = skyR + bnd * 0.36
489 skyG = skyG + bnd * 0.13
490 skyB = skyB + bnd * 0.045
491 cn = fbm(qx * 1.5 + time * 0.010, sy * 2.2 + 1.0 + time * 0.005, 3)
492 ce = smooth(0.50, 0.66, cn) * smooth(0.03, 0.18, hgt) * (1.0 - smooth(0.70, 1.0, hgt))
493 crm = smooth(0.60, 0.655, cn) * (1.0 - smooth(0.655, 0.72, cn))
494 skyR = mix(skyR, 0.022, ce * 0.65) + crm * (0.14 + 0.55 * bnd)
495 skyG = mix(skyG, 0.014, ce * 0.65) + crm * (0.06 + 0.24 * bnd)
496 skyB = mix(skyB, 0.042, ce * 0.65) + crm * (0.07 + 0.10 * bnd)
497 rgb(skyR, skyG, skyB)
499 # stars
500 gx = qx * 60.0 + 9.0
501 gy = sy * 34.0 + 3.0
502 ix = floor(gx)
503 iy = floor(gy)
504 hs = hash(ix * 1.31 + iy * 7.77)
505 st = step(0.958, hs) * (1.0 - ce) * smooth(0.18, 0.50, hgt)
506 sdx = fract(gx) - 0.5 - (hash(ix + iy * 2.3) - 0.5) * 0.5
507 sdy = fract(gy) - 0.5 - (hash(ix * 3.7 + iy) - 0.5) * 0.5
508 sd = len(sdx, sdy)
509 sdot = (1.0 - smooth(0.05, 0.15 + 0.10 * hs, sd)) * st
510 tw = 0.55 + 0.45 * sin(time * (1.5 + 3.0 * hs) + hs * 40.0)
511 cadd(sdot * tw * 0.95, sdot * tw * 0.90, sdot * tw * 0.78)
513 # ---------------- the moon has a face
514 mx = -0.62
515 my = 0.32
516 Rm = 0.32
517 mdx = qx - mx
518 mdy = sy - my
519 md = len(mdx, mdy)
520 disc = 1.0 - smooth(Rm - 0.004, Rm + 0.002, md)
521 nz = sqrt(max(0.0, 1.0 - (md / Rm) * (md / Rm)))
522 mar = fbm(qx * 4.4 + 2.0, sy * 4.4 - 1.0, 2)
523 mlum = (0.58 + 0.42 * nz) * (0.82 + 0.22 * mar) * (0.92 + 0.08 * glow)
524 mr = 1.00 * mlum
525 mg = 0.90 * mlum
526 mb = 0.68 * mlum
527 hal = exp(-max(0.0, md - Rm) * 8.0) * (0.16 + 0.10 * glow)
528 cadd(hal * 0.80, hal * 0.52, hal * 0.26)
529 cmul(1.0 - disc)
530 cadd(mr * disc, mg * disc, mb * disc)
531 # eyes
532 ex = abs(mdx) - 0.112
533 ey = mdy - 0.070
534 eop = clamp(eye, 0.04, 1.3)
535 ed = len(ex / 0.082, ey / (0.034 * eop))
536 em = (1.0 - smooth(0.66, 1.0, ed)) * disc
537 cmul(1.0 - em * faceA * 0.96)
538 gl = (1.0 - smooth(0.0, 0.012, len(mdx - 0.065, mdy - 0.082))) * disc
539 cadd(gl * faceA * 0.95, gl * faceA * 0.88, gl * faceA * 0.62)
540 # smile
541 rho = len(mdx, mdy - 0.125)
542 mum = exp(-abs(rho - 0.250) * 44.0) * step(abs(mdx), 0.080 + 0.100 * smile) * step(mdy, 0.060) * disc
543 cmul(1.0 - mum * faceA * 0.92)
544 # nose
545 nm = exp(-abs(len(mdx * 1.8, mdy + 0.010)) * 24.0) * disc
546 cmul(1.0 - nm * faceA * 0.30)
547 # two painted cheeks
548 ck = exp(-len((mdx - 0.17) / 0.055, (mdy + 0.045) / 0.055) * 2.0) * faceA
549 cmul(1.0 - ck * 0.16)
551 # ---------------- paper lanterns rising behind the tents
552 lgx = qx * 4.6
553 lgy = (sy - time * 0.030) * 3.0
554 li = floor(lgx)
555 lj = floor(lgy)
556 lh = hash(li * 17.13 + lj * 5.31)
557 lfx = fract(lgx) - 0.5 - (hash(li * 3.17 + lj * 7.71) - 0.5) * 0.55
558 lfy = fract(lgy) - 0.5 - (hash(li * 5.91 + lj * 2.33) - 0.5) * 0.55
559 ld = len(lfx * 0.7, lfy * 1.2)
560 lan = step(0.72, lh) * (1.0 - smooth(0.03, 0.17, ld)) * smooth(0.10, 0.35, hgt)
561 lgl = exp(-ld * 9.0) * 0.05 * smooth(0.10, 0.35, hgt)
562 cadd((lan + lgl * 0.6) * 1.00, (lan * 0.45 + lgl * 0.3) * 0.90, (lan * 0.15 + lgl * 0.1) * 0.90)
564 # ---------------- the wheel
565 fwx = qx - 1.02
566 fwy = sy - 0.18
567 fwr = len(fwx, fwy)
568 fwa = atan2(fwy, fwx)
569 spa = abs(fract(fwa / tau * 10.0 + wheelA / tau) - 0.5)
570 spd = spa * fwr * 1.5
571 spoke = exp(-spd * 150.0) * step(fwr, 0.335) * step(0.028, fwr)
572 rim = exp(-abs(fwr - 0.335) * 160.0)
573 rim2 = exp(-abs(fwr - 0.295) * 190.0) * 0.45
574 hub = exp(-fwr * 140.0)
575 cabg = exp(-abs(fwr - 0.335) * 18.0) * exp(-spd * 26.0)
576 bid = floor(fwa / tau * 10.0 + wheelA / tau)
577 bfl = 0.62 + 0.38 * sin(time * 2.4 + bid * 1.9)
578 cadd((spoke * 0.22 + rim * 0.62 + rim2 * 0.22 + hub * 0.55) * 0.80,
579 (spoke * 0.13 + rim * 0.36 + rim2 * 0.12 + hub * 0.40) * 0.80,
580 (spoke * 0.05 + rim * 0.13 + rim2 * 0.05 + hub * 0.15) * 0.80)
581 cadd(cabg * 1.20 * bfl, cabg * 0.55 * bfl, cabg * 0.16 * bfl)
582 cadd(exp(-abs(fwr - 0.335) * 9.0) * 0.045, exp(-abs(fwr - 0.335) * 9.0) * 0.018, 0.0)
584 # ---------------- tents
585 tent(qx, sy, 0.12, 0.96, -0.02, 0.36, -0.22, 0.08)
586 tent(qx, sy, -1.22, 0.58, -0.06, 0.14, -0.20, 0.31)
587 tent(qx, sy, 1.62, 0.62, -0.08, 0.12, -0.20, 0.55)
589 # ---------------- strings (part of the world, so they reflect)
590 lantstring(qx, sy, 0.58, 0.11, 0.46, 0.026, 1.7, 1.0)
591 lantstring(qx, sy, 0.30, 0.09, 0.60, 0.022, 4.3, 0.85)
593 # ---------------- paving, reflection and ripples
594 depth = smooth(0.0, 0.16, rr)
595 pz = 1.0 / (rr + 0.012)
596 wxx = qx * pz * 0.42
597 wzz = pz * 0.42
598 ta = abs(fract(wxx * 1.1) - 0.5)
599 tb = abs(fract(wzz * 1.1) - 0.5)
600 ln = clamp((1.0 - smooth(0.0, 0.035, ta)) + (1.0 - smooth(0.0, 0.035, tb)), 0.0, 1.0) * smooth(0.02, 0.16, rr)
601 gr = 0.030 + 0.018 * sin(wxx * 3.0) - 0.016 * ln
602 gg = 0.024 + 0.010 * sin(wxx * 3.0) - 0.012 * ln
603 gb = 0.032 + 0.012 * cos(wxx * 2.0) - 0.012 * ln
604 rcr = cget(0)
605 rcg = cget(1)
606 rcb = cget(2)
607 refR = rcr * 0.46 + 0.006
608 refG = rcg * 0.43 + 0.006
609 refB = rcb * 0.58 + 0.020
610 glint = smooth(0.60, 0.96, sin(rr * 24.0 + qx * 7.0 - time * 2.2)) * (0.14 + 0.18 * glow)
611 fR = mix(rcr, mix(refR, gr, depth * 0.62) + glint * 1.0, gnd)
612 fG = mix(rcg, mix(refG, gg, depth * 0.62) + glint * 0.48, gnd)
613 fB = mix(rcb, mix(refB, gb, depth * 0.62) + glint * 0.15, gnd)
614 rgb(fR, fG, fB)
615 hl = exp(-abs(qy - hor) * 300.0) * (0.22 + 0.20 * glow)
616 cadd(hl * 0.55, hl * 0.30, hl * 0.10)
617 dg = len((qx - 0.12) / 0.62, (qy + 0.33) / 0.24)
618 spill = (1.0 - smooth(0.15, 1.0, dg)) * gnd * (0.10 + 0.12 * glow)
619 cadd(spill * 1.0, spill * 0.42, spill * 0.10)
621 # ---------------- a lantern string hanging in front of the lens
622 lantstring(u, v, 1.06, 0.05, 0.28, 0.052, 7.1, 1.15)
624 # ---------------- the audience
625 crowd(qx, qy, -0.56, 0.13, 0.27, 9.0, 2.0, 0.82)
627 # ---------------- one watcher close to us, in a hat, and their little moon
628 wh = len((qx + 1.16) / 0.200, (qy + 0.600) / 0.220)
629 wb = len((qx + 1.16) / 0.620, (qy + 1.340) / 0.640)
630 hbrim = len((qx + 1.16) / 0.330, (qy + 0.350) / 0.036)
631 hcrown = len((qx + 1.16) / 0.165, (qy + 0.265) / 0.095)
632 wat = max(max(1.0 - smooth(0.82, 1.0, wh), 1.0 - smooth(0.80, 1.0, wb)),
633 max(1.0 - smooth(0.70, 1.0, hbrim), 1.0 - smooth(0.80, 1.0, hcrown)))
634 cmul(1.0 - wat * 0.97)
635 # their balloon, a second little face
636 blx = -0.56 + 0.018 * sin(time * 0.37)
637 bly = -0.10 + 0.014 * sin(time * 0.61 + 1.0)
638 bld = len(qx - blx, qy - bly)
639 bal = 1.0 - smooth(0.052, 0.060, bld)
640 bsh = sqrt(max(0.0, 1.0 - (bld / 0.056) * (bld / 0.056)))
641 cadd(bal * (0.30 + 0.72 * bsh), bal * (0.20 + 0.66 * bsh), bal * (0.11 + 0.46 * bsh))
642 bsm = exp(-abs(len(qx - blx, qy - bly + 0.030) - 0.030) * 90.0) * bal
643 cmul(1.0 - bsm * 0.60)
644 # the string from the watcher's hand up to the balloon
645 sax = qx + 0.82
646 say = qy + 0.55
647 slt = clamp((sax * 0.26 + say * 0.43) / 0.2525, 0.0, 1.0)
648 sdx = sax - 0.26 * slt
649 sdy = say - 0.43 * slt
650 sline = exp(-len(sdx, sdy) * 700.0)
651 cadd(sline * 0.22, sline * 0.18, sline * 0.13)
653 # ---------------- confetti
654 repeat k 4 {
655 chx = (hash(k * 7.13 + 2.0) - 0.5) * 3.1
656 chy = fract(hash(k * 3.71 + 8.0) + time * (0.025 + 0.030 * hash(k * 1.9))) * 2.4 - 1.15
657 rv = rot(u - chx - 0.05 * sin(time * 0.8 + k * 2.0), v - chy, time * 1.7 + k)
658 fl = (1.0 - smooth(0.005, 0.011, abs(rv))) * (1.0 - smooth(0.002, 0.004, abs(r1)))
659 cadd(fl * conf * 1.10, fl * conf * 0.62, fl * conf * 0.30)
660 }
662 # ---------------- the title
663 ta2 = clamp(titleA, 0.0, 1.0)
664 tsh = word(ttitle, 0.862, 0.210, ta2, 0.010)
665 tg = word(ttitle, 0.877, 0.210, ta2, 0.0)
666 worn = 0.78 + 0.30 * hash(floor(u * 130.0) * 1.7 + floor(v * 130.0) * 3.1)
667 cmul(1.0 - tsh * 0.75)
668 cadd(tg * 1.10 * worn, tg * 0.94 * worn, tg * 0.70 * worn)
669}
671# ------------------------------------------------------------------ the face
672pixel grin {
673 br = 1.0 + 0.012 * sin(time * 0.53) + 0.010 * kickE
674 qx0 = u / br + 0.020 * sin(time * 0.31)
675 qy0 = v / br + 0.014 * sin(time * 0.27) - 0.010
676 ra = 0.030 * sin(time * 0.19)
677 qx = rot(qx0, qy0, ra)
678 qy = r1
680 fx = qx / 1.30
681 fy = (qy - 0.02) / 1.02
682 fr = len(fx, fy)
683 face = 1.0 - smooth(0.975, 1.0, fr)
684 edge = exp(-abs(fr - 1.0) * 120.0)
686 # ---------------- plaster, cracks and flaking paint
687 pn = fbm(qx * 3.0 + 1.3, qy * 3.0 - 2.1, 3)
688 pn2 = fbm(qx * 11.0 - 3.0, qy * 11.0 + 1.0, 2)
689 pv = vor(qx * 3.6 + pn * 0.7, qy * 3.6 - pn * 0.5)
690 dv1 = pv
691 vid = r1
692 dv2 = r2
693 crack = exp(-(dv2 - dv1) * 110.0) * step(0.30, hash(vid * 31.7 + 2.0))
694 flake = step(0.78, hash(vid * 7.3 + 9.0))
695 basR = 0.60 + 0.18 * (pn - 0.5) + 0.07 * (pn2 - 0.5)
696 basG = 0.535 + 0.17 * (pn - 0.5) + 0.06 * (pn2 - 0.5)
697 basB = 0.415 + 0.15 * (pn - 0.5) + 0.05 * (pn2 - 0.5)
698 grm = smooth(0.35, 1.0, fr) * 0.40
699 basR = basR * (1.0 - grm) + 0.12 * grm
700 basG = basG * (1.0 - grm) + 0.09 * grm
701 basB = basB * (1.0 - grm) + 0.07 * grm
702 basR = basR * (1.0 - crack * 0.80)
703 basG = basG * (1.0 - crack * 0.80)
704 basB = basB * (1.0 - crack * 0.80)
705 basR = mix(basR, 0.62 + 0.08 * pn2, flake * 0.35)
706 basG = mix(basG, 0.46 + 0.06 * pn2, flake * 0.35)
707 basB = mix(basB, 0.40 + 0.05 * pn2, flake * 0.35)
708 nz = sqrt(max(0.0, 1.0 - fr * fr))
709 shd = 0.34 + 0.66 * nz + 0.12 * clamp(-qy * 0.6 - qx * 0.3, -1.0, 1.0)
710 warm = clamp(0.55 - qy, 0.0, 1.0)
711 basR = basR * shd + 0.070 * warm
712 basG = basG * shd + 0.030 * warm
713 basB = basB * shd + 0.008 * warm
715 # ---------------- painted cheeks
716 ckl = len((qx + 0.63) / 0.30, (qy + 0.15) / 0.24)
717 ckr = len((qx - 0.63) / 0.30, (qy + 0.15) / 0.24)
718 ck = clamp((1.0 - smooth(0.55, 1.0, ckl)) + (1.0 - smooth(0.55, 1.0, ckr)), 0.0, 1.0)
719 ck = ck * (0.55 + 0.45 * pn2)
720 basR = mix(basR, 0.74, ck * 0.45)
721 basG = mix(basG, 0.20, ck * 0.45)
722 basB = mix(basB, 0.22, ck * 0.45)
724 # ---------------- the diamond on the forehead
725 dia = abs(qx) + abs(qy - 0.58)
726 dm = 1.0 - smooth(0.062, 0.072, dia)
727 drim = exp(-abs(dia - 0.078) * 90.0)
728 basR = mix(basR, 0.66, dm)
729 basG = mix(basG, 0.05, dm)
730 basB = mix(basB, 0.09, dm)
731 basR = basR + drim * 0.55
732 basG = basG + drim * 0.36
733 basB = basB + drim * 0.12
735 # ---------------- the eyes are holes with a fair inside them
736 sgn = sign(qx)
737 ex = abs(qx) - 0.43 + 0.020 * warp * sgn
738 ey = qy - 0.21
739 tilt = 0.10 * ex * sgn
740 eop = clamp(eye, 0.04, 1.4)
741 ed = len(ex / 0.248, (ey + tilt) / (0.108 * eop))
742 eyeM = 1.0 - smooth(0.82, 1.0, ed)
743 inner = clamp(1.0 - ed, 0.0, 1.0)
744 inR = 0.012 + 0.020 * inner
745 inG = 0.016 + 0.022 * inner
746 inB = 0.048 + 0.040 * inner
747 hz = exp(-abs(qy - 0.178) * 30.0) * inner
748 inR = inR + hz * 0.40
749 inG = inG + hz * 0.17
750 inB = inB + hz * 0.06
751 gld = len((abs(qx) - 0.43) + 0.05, qy - 0.245)
752 glint = (1.0 - smooth(0.008, 0.018, gld)) * inner
753 dot1 = (1.0 - smooth(0.004, 0.010, len((abs(qx) - 0.43) - 0.10, qy - 0.23))) * inner
754 dot2 = (1.0 - smooth(0.003, 0.008, len((abs(qx) - 0.43) + 0.13, qy - 0.19))) * inner
755 inR = inR + glint * 1.00 + dot1 * 0.80 + dot2 * 0.50
756 inG = inG + glint * 0.92 + dot1 * 0.42 + dot2 * 0.24
757 inB = inB + glint * 0.62 + dot1 * 0.14 + dot2 * 0.07
758 basR = mix(basR, inR, eyeM)
759 basG = mix(basG, inG, eyeM)
760 basB = mix(basB, inB, eyeM)
761 liner = exp(-abs(ed - 1.0) * 24.0)
762 basR = basR + liner * 0.42
763 basG = basG + liner * 0.28
764 basB = basB + liner * 0.10
765 lash = exp(-abs(ed - 1.16) * 55.0) * 0.30
766 basR = basR * (1.0 - lash)
767 basG = basG * (1.0 - lash)
768 basB = basB * (1.0 - lash)
770 # ---------------- nose
771 nridge = exp(-abs(qx - 0.014) * 90.0) * step(-0.10, qy) * step(qy, 0.16)
772 ntip = exp(-len((qx - 0.010) / 0.045, (qy + 0.115) / 0.035) * 2.0) * step(qy, 0.0)
773 basR = basR * (1.0 - 0.10 * nridge - 0.16 * ntip)
774 basG = basG * (1.0 - 0.13 * nridge - 0.18 * ntip)
775 basB = basB * (1.0 - 0.15 * nridge - 0.18 * ntip)
776 basR = basR * (1.0 + 0.10 * exp(-abs(qx + 0.030) * 110.0) * step(-0.06, qy) * step(qy, 0.14))
778 # ---------------- the grin
779 wm = 0.46 + 0.22 * smile
780 mtop = -0.32
781 curve = 0.16 + 0.10 * smile
782 xn = clamp(qx / max(wm, 0.01), -1.0, 1.0)
783 yb = mtop - curve * (1.0 - xn * xn) - 0.05 * warp * xn
784 inX = step(abs(qx), wm)
785 mouth = inX * step(qy, mtop) * step(yb, qy)
786 basR = mix(basR, 0.10, mouth)
787 basG = mix(basG, 0.015, mouth)
788 basB = mix(basB, 0.025, mouth)
789 tgap = step(0.15, abs(fract(qx / 0.080 + 0.5) - 0.5) * 2.0)
790 tb = step(qy, mtop - 0.005) * step(mtop - 0.085, qy) * mouth * tgap
791 basR = mix(basR, 0.88, tb)
792 basG = mix(basG, 0.83, tb)
793 basB = mix(basB, 0.68, tb)
794 gum = step(qy, mtop - 0.085) * step(mtop - 0.125, qy) * mouth
795 basR = mix(basR, 0.24, gum)
796 basG = mix(basG, 0.02, gum)
797 basB = mix(basB, 0.03, gum)
798 tb2 = step(qy, yb + 0.055) * step(yb + 0.006, qy) * mouth * tgap
799 basR = mix(basR, 0.80, tb2)
800 basG = mix(basG, 0.75, tb2)
801 basB = mix(basB, 0.60, tb2)
802 lip = (exp(-abs(qy - mtop) * 55.0) + exp(-abs(qy - yb) * 55.0)) * inX
803 basR = mix(basR, 0.92, lip * 0.85)
804 basG = mix(basG, 0.70, lip * 0.85)
805 basB = mix(basB, 0.30, lip * 0.85)
806 # a single dark tear track under the right eye
807 trk = exp(-abs(qx - 0.455 - 0.012 * sin(qy * 10.0)) * 150.0) * step(-0.42, qy) * step(qy, 0.10)
808 basR = mix(basR, 0.26, trk * 0.55)
809 basG = mix(basG, 0.04, trk * 0.55)
810 basB = mix(basB, 0.05, trk * 0.55)
811 trh = exp(-abs(qx - 0.441 - 0.012 * sin(qy * 10.0)) * 260.0) * step(-0.42, qy) * step(qy, 0.10)
812 basR = mix(basR, 0.82, trh * 0.35)
813 basG = mix(basG, 0.74, trh * 0.35)
814 basB = mix(basB, 0.60, trh * 0.35)
815 bm = 1.0 - smooth(0.008, 0.014, len(qx - 0.32, qy + 0.55))
816 basR = basR * (1.0 - bm * 0.7)
817 basG = basG * (1.0 - bm * 0.7)
818 basB = basB * (1.0 - bm * 0.7)
820 # ---------------- the void around it
821 bgr = 0.016 + 0.008 * sin(qy * 3.0 + time * 0.2)
822 bgg = 0.009
823 bgb = 0.024 + 0.008 * sin(qx * 2.0)
824 rgb(bgr, bgg, bgb)
825 repeat k 4 {
826 bxp = (hash(k * 3.7 + 1.0) - 0.5) * 3.4
827 byp = (hash(k * 5.3 + 4.0) - 0.5) * 2.2
828 bd = len(u - bxp, v - byp)
829 bg = (exp(-bd * 5.0) * 0.10 + exp(-bd * 24.0) * 0.10) * (1.0 - face)
830 cadd(bg * 0.90, bg * 0.45, bg * 0.14)
831 }
832 repeat k 4 {
833 dxp = (hash(k * 9.1 + 3.0) - 0.5) * 3.2 + 0.10 * sin(time * 0.5 + k)
834 dyp = fract(hash(k * 2.7 + 6.0) + time * (0.020 + 0.020 * hash(k * 4.1))) * 2.4 - 1.2
835 dd = len(u - dxp, v - dyp)
836 spd2 = (1.0 - smooth(0.002, 0.006, dd)) * 0.32 * (1.0 - face * 0.6)
837 cadd(spd2, spd2 * 0.85, spd2 * 0.55)
838 }
839 cmul(1.0 - face)
840 cadd(basR * face, basG * face, basB * face)
841 cadd(edge * 0.50, edge * 0.34, edge * 0.14)
842}
844# ------------------------------------------------------------------ post
845post {
846 cr = cget(0)
847 cg = cget(1)
848 cb = cget(2)
849 bl = (tap(-2, 0) + tap(2, 0) + tap(0, -2) + tap(0, 2) + tap(-4, -3) + tap(4, 3)) * 0.1667 * (1.0 - 0.40 * scn)
850 sh = floor(1.0 + 3.0 * flash)
851 ar = tap(-1.0 - sh, 0.0)
852 ab = tap(1.0 + sh, 1.0)
853 cr = (cr * 0.92 + bl * 0.42 + ar * 0.18 * flash - 0.030) * 1.16
854 cg = (cg * 0.92 + bl * 0.37 - 0.026) * 1.14
855 cb = (cb * 0.96 + bl * 0.50 + ab * 0.22 * flash - 0.026) * 1.12
856 gn = (hash(x * w * 0.37 + y * h * 0.71 + frame * 7.31) - 0.5) * 0.032
857 rgb(cr + gn + 0.006, cg + gn * 0.9 + 0.004, cb + gn * 0.8 + 0.012)
858 d = len(u, v)
859 cmul(1.0 - 0.46 * d * d)
860 cadd(flash * 0.55, flash * 0.45, flash * 0.30)
861}
Click a line number to link to that line.
CELLS →