Repository navigation
Expand file tree
/
Copy pathindex.html
More file actions
723 lines (654 loc) · 54.3 KB
/
Copy pathindex.html
File metadata and controls
723 lines (654 loc) · 54.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>compositor-glare — Examples — Blender Developer Tools</title>
<meta name="description" content="Bloom where it actually lives — a compositor Glare (Fog Glow) node fed by Render Layers, wired via scene.compositing_node_group on 5.x and scene.node_tree on 4.x, with the Glare node's legacy properties vs 5.x menu sockets." />
<link rel="canonical" href="https://tmhsdigital.github.io/Blender-Developer-Tools/gallery/compositor-glare/" />
<link rel="icon" href="../../assets/favicon.svg" type="image/svg+xml" />
<meta name="theme-color" content="#1a1b1e" />
<meta name="color-scheme" content="dark" />
<meta property="og:type" content="website" />
<meta property="og:title" content="compositor-glare — Examples — Blender Developer Tools" />
<meta property="og:description" content="Bloom where it actually lives — a compositor Glare (Fog Glow) node fed by Render Layers, wired via scene.compositing_node_group on 5.x and scene.node_tree on 4.x, with the Glare node's legacy properties vs 5.x menu sockets." />
<meta property="og:url" content="https://tmhsdigital.github.io/Blender-Developer-Tools/gallery/compositor-glare/" />
<meta property="og:image" content="https://tmhsdigital.github.io/Blender-Developer-Tools/gallery/assets/compositor-glare-hero.webp" />
<meta property="og:image:width" content="1280" />
<meta property="og:image:height" content="720" />
<meta property="og:image:alt" content="compositor-glare: the example's own headless render" />
<meta property="og:site_name" content="Blender Developer Tools" />
<meta name="twitter:card" content="summary_large_image" />
<meta name="twitter:title" content="compositor-glare — Examples — Blender Developer Tools" />
<meta name="twitter:description" content="Bloom where it actually lives — a compositor Glare (Fog Glow) node fed by Render Layers, wired via scene.compositing_node_group on 5.x and scene.node_tree on 4.x, with the Glare node's legacy properties vs 5.x menu sockets." />
<meta name="twitter:image" content="https://tmhsdigital.github.io/Blender-Developer-Tools/gallery/assets/compositor-glare-hero.webp" />
<meta name="twitter:image:alt" content="compositor-glare: the example's own headless render" />
<style>
/* fonts are deployed by the landing build (docs/fonts/) */
@font-face { font-family: 'Barlow Condensed'; font-weight: 600; font-display: swap;
src: url('../../fonts/barlow-condensed-600.woff2') format('woff2'); }
@font-face { font-family: 'Inter'; font-weight: 400; font-display: swap;
src: url('../../fonts/inter-regular.woff2') format('woff2'); }
@font-face { font-family: 'Inter'; font-weight: 500; font-display: swap;
src: url('../../fonts/inter-medium.woff2') format('woff2'); }
@font-face { font-family: 'JetBrains Mono'; font-weight: 400; font-display: swap;
src: url('../../fonts/jetbrains-mono-regular.woff2') format('woff2'); }
/* Blender-viewport system, shared with the landing page. Dark only. */
:root {
color-scheme: dark;
--bg: #1a1b1e; --surface: #222327; --surface-2: #2a2b30; --bg2: #131417;
--border: #3a3b40; --text: #e8e9eb; --text-dim: #9698a0;
--select: #ff8c19; --ok: #6dc96d;
--radius: 4px; --radius-lg: 6px; --maxw: 1080px;
--font-display: 'Barlow Condensed', 'Arial Narrow', sans-serif;
--font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
--font-mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
--code-k: #ff7b72; --code-s: #a5d6ff; --code-c: #9698a0; --code-n: #79c0ff;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body { font-family: var(--font-sans); background: var(--bg); color: var(--text);
line-height: 1.6; min-height: 100vh; -webkit-font-smoothing: antialiased; }
a { color: var(--select); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--select); outline-offset: 2px; border-radius: 3px; }
::selection { background: color-mix(in srgb, var(--select) 40%, transparent); }
.skip { position: absolute; left: -999px; top: 0; background: var(--select); color: #1a1b1e;
padding: 0.5rem 1rem; border-radius: var(--radius); z-index: 10; font-weight: 500; }
.skip:focus { left: 0.5rem; top: 0.5rem; }
.hud { font-family: var(--font-mono); font-size: 0.6875rem; letter-spacing: 0.04em;
color: var(--text-dim); text-transform: uppercase; }
.topbar { position: sticky; top: 0; z-index: 5; display: flex; align-items: center;
justify-content: space-between; gap: 1rem; padding: 0 1.25rem; height: 46px;
background: color-mix(in srgb, var(--surface) 92%, transparent);
backdrop-filter: blur(10px); border-bottom: 1px solid var(--border); }
.topbar .back { color: var(--text-dim); font-size: 0.8125rem; font-weight: 500; }
.topbar .back:hover { color: var(--select); text-decoration: none; }
.topbar-right { display: flex; align-items: center; gap: 0.85rem; }
.topbar-right .ghlink { color: var(--text-dim); font-size: 0.8125rem; font-weight: 500; }
.topbar-right .ghlink:hover { color: var(--select); text-decoration: none; }
header.hero { max-width: var(--maxw); margin: 0 auto; padding: 2.75rem 1.25rem 1.25rem; }
header.hero h1 { font-family: var(--font-display); font-weight: 600; text-transform: uppercase;
font-size: clamp(2.2rem, 5vw, 3.4rem); letter-spacing: 0.005em; line-height: 0.98; }
header.hero p { color: var(--text-dim); max-width: 62ch; margin-top: 0.7rem; font-size: 1rem; }
/* ---- index: sticky controls (search, density toggle, tag chips) ---- */
.controls { position: sticky; top: 46px; z-index: 4;
background: color-mix(in srgb, var(--bg) 94%, transparent);
backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
border-bottom: 1px solid var(--border); }
.controls-inner { max-width: var(--maxw); margin: 0 auto; padding: 0.55rem 1.25rem 0.6rem;
display: flex; flex-direction: column; gap: 0.5rem; }
.controls-row { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; }
.searchwrap { position: relative; flex: 1 1 240px; min-width: 150px; }
.searchwrap input { width: 100%; background: var(--surface-2); border: 1px solid var(--border);
color: var(--text); border-radius: var(--radius); padding: 0.34rem 1.9rem 0.34rem 0.7rem;
font-family: var(--font-sans); font-size: 0.85rem; line-height: 1.4; }
.searchwrap input:focus { border-color: var(--select); outline: none; }
.searchwrap input::placeholder { color: var(--text-dim); }
.searchwrap input::-webkit-search-cancel-button { -webkit-appearance: none; appearance: none; }
.q-clear { position: absolute; right: 0.2rem; top: 50%; transform: translateY(-50%);
background: none; border: none; color: var(--text-dim); font-size: 1.05rem; line-height: 1;
cursor: pointer; padding: 0.25rem 0.45rem; border-radius: 3px; }
.q-clear:hover { color: var(--select); }
.count { font-family: var(--font-mono); font-size: 0.68rem; letter-spacing: 0.04em;
text-transform: uppercase; color: var(--text-dim); white-space: nowrap; }
.density { display: flex; border: 1px solid var(--border); border-radius: var(--radius);
overflow: hidden; }
.density-btn { background: var(--surface-2); border: none; color: var(--text-dim); cursor: pointer;
font-family: var(--font-mono); font-size: 0.68rem; letter-spacing: 0.04em;
text-transform: uppercase; padding: 0.36rem 0.7rem; transition: color 0.15s, background 0.15s; }
.density-btn + .density-btn { border-left: 1px solid var(--border); }
.density-btn:hover { color: var(--select); }
.density-btn.active { background: var(--select); color: #1a1b1e; }
.tags-toggle { display: none; background: var(--surface-2); border: 1px solid var(--border);
color: var(--text-dim); border-radius: 3px; padding: 0.3rem 0.7rem; cursor: pointer;
font-family: var(--font-mono); font-size: 0.7rem; letter-spacing: 0.04em; text-transform: uppercase; }
.tags-toggle:hover, .tags-toggle.has-active { color: var(--select); border-color: var(--select); }
/* Tag chips wrap by default (no-JS safe). With JS the row becomes a scroll
strip on wide viewports and collapses behind the Tags toggle on narrow
ones, so the sticky bar never eats the mobile viewport. */
.chips { display: flex; flex-wrap: wrap; gap: 0.4rem; }
html.js .chips { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 0.25rem;
scrollbar-width: thin; scrollbar-color: var(--border) transparent; }
html.js .chips::-webkit-scrollbar { height: 5px; }
html.js .chips::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
.chip { background: var(--surface-2); border: 1px solid var(--border); color: var(--text-dim);
border-radius: 3px; padding: 0.22rem 0.7rem; font-size: 0.72rem; font-weight: 400;
font-family: var(--font-mono); cursor: pointer; white-space: nowrap; flex: 0 0 auto;
transition: color 0.15s, border-color 0.15s; }
.chip:hover { color: var(--select); border-color: var(--select); }
.chip.active { color: #1a1b1e; background: var(--select); border-color: var(--select); }
@media (max-width: 719px) {
html.js .tags-toggle { display: inline-block; }
html.js .chips { display: none; }
html.js .chips.open { display: flex; flex-wrap: wrap; overflow-y: auto; max-height: 40vh; }
}
/* Compact density: hero + name + one-line teaser. The description and
WITNESSES text stay in the DOM (searchable, screen-reader reachable,
present with JS disabled when the class is never applied) but are
visually collapsed. Applied only by JS via the density-compact class. */
html.density-compact .grid { gap: 1rem; }
html.density-compact .card-body { padding: 0.65rem 0.9rem 0.7rem; }
html.density-compact .card-body h2 { font-size: 0.88rem; margin-bottom: 0.15rem; }
html.density-compact .teaches { font-size: 0.8rem; color: var(--text-dim); margin-bottom: 0;
white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
html.density-compact .witnesses { position: absolute; width: 1px; height: 1px; margin: -1px;
padding: 0; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }
html.density-compact .card-link { display: none; }
.noresults { color: var(--text-dim); text-align: center; padding: 3rem 1rem; font-size: 0.95rem; }
.noresults .chip { margin-left: 0.6rem; }
.to-top { position: fixed; right: 1.25rem; bottom: 1.25rem; z-index: 6; cursor: pointer;
background: var(--surface-2); border: 1px solid var(--border); color: var(--text-dim);
border-radius: var(--radius); padding: 0.45rem 0.75rem;
font-family: var(--font-mono); font-size: 0.7rem; letter-spacing: 0.04em;
text-transform: uppercase; opacity: 0; visibility: hidden;
transition: opacity 0.2s, visibility 0.2s, color 0.15s, border-color 0.15s; }
.to-top.show { opacity: 1; visibility: visible; }
.to-top:hover { color: var(--select); border-color: var(--select); }
main { max-width: var(--maxw); margin: 0 auto; padding: 1rem 1.25rem 2rem; }
.grid { display: grid; grid-template-columns: 1fr; gap: 1.5rem; align-items: stretch; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
overflow: hidden; display: flex; flex-direction: column;
outline: 2px solid transparent; outline-offset: -1px;
transition: outline-color 0.12s ease, border-color 0.12s ease; }
.card:hover { border-color: var(--select); outline-color: var(--select); }
.card.hidden { display: none; }
.card-media { display: block; background: var(--bg2); line-height: 0; }
.card-media img { display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: cover; }
.card-body { padding: 1.15rem 1.4rem 1.45rem; display: flex; flex-direction: column; flex: 1 1 auto; }
.card-body h2 { font-family: var(--font-mono); font-size: 1rem; font-weight: 400; margin-bottom: 0.5rem; }
.card-body h2 a { color: var(--text); }
.card-body h2 a:hover { color: var(--select); text-decoration: none; }
.teaches { color: var(--text); margin-bottom: 0.7rem; font-size: 0.92rem; }
.witnesses { color: var(--text-dim); font-size: 0.85rem; margin-bottom: 1rem; }
.tag { display: inline-block; font-family: var(--font-mono); font-size: 0.62rem; text-transform: uppercase;
letter-spacing: 0.06em; color: var(--select); border: 1px solid color-mix(in srgb, var(--select) 55%, transparent);
border-radius: 3px; padding: 0.08rem 0.5rem; margin-right: 0.4rem; vertical-align: 1px; }
.card-link { font-weight: 600; font-size: 0.95rem; margin-top: auto; }
/* ---- detail page ---- */
.detail-hero { border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden;
background: var(--bg2); padding: 0; display: block; width: 100%; cursor: zoom-in; line-height: 0; }
.detail-hero img { display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: cover; }
.zoom-hint { color: var(--text-dim); font-size: 0.78rem; margin-top: 0.4rem; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0);
white-space: nowrap; }
.callout { border: 1px solid color-mix(in srgb, var(--select) 45%, var(--border));
border-left: 3px solid var(--select); border-radius: var(--radius);
background: color-mix(in srgb, var(--select) 7%, var(--surface));
padding: 0.85rem 1.1rem; margin: 1.5rem 0; font-size: 0.95rem; }
.runline { display: flex; align-items: stretch; gap: 0.5rem; margin: 1.5rem 0; }
.runline pre { flex: 1 1 auto; background: var(--surface-2); border: 1px solid var(--border);
border-radius: var(--radius); padding: 0.7rem 0.9rem; overflow-x: auto;
font-family: var(--font-mono); font-size: 0.83rem; line-height: 1.5; }
.copy-btn { flex: 0 0 auto; background: var(--surface-2); border: 1px solid var(--border);
color: var(--text-dim); border-radius: var(--radius); padding: 0 0.85rem; cursor: pointer;
font-family: var(--font-sans); font-size: 0.82rem; font-weight: 500; transition: color 0.15s, border-color 0.15s; }
.copy-btn:hover { color: var(--select); border-color: var(--select); }
.detail-section { margin-top: 2.25rem; }
.detail-section > h2 { font-family: var(--font-display); font-weight: 600; text-transform: uppercase;
font-size: 1.45rem; letter-spacing: 0.005em; padding-bottom: 0.5rem;
border-bottom: 1px solid var(--border); margin-bottom: 1rem; }
.md h1, .md h2, .md h3 { letter-spacing: -0.01em; margin: 1.4rem 0 0.6rem; line-height: 1.25; }
.md h1 { font-size: 1.35rem; } .md h2 { font-size: 1.15rem; } .md h3 { font-size: 1rem; }
.md p { margin: 0.7rem 0; }
.md ul, .md ol { margin: 0.7rem 0 0.7rem 1.4rem; }
.md li { margin: 0.3rem 0; }
.md .table-wrap { overflow-x: auto; margin: 0.9rem 0; }
.md table { border-collapse: collapse; font-size: 0.86rem; min-width: 100%; }
.md th, .md td { text-align: left; vertical-align: top; padding: 0.4rem 0.75rem 0.4rem 0;
border-bottom: 1px solid var(--border); }
.md th { color: var(--text-dim); font-weight: 600; white-space: nowrap; }
.md code { background: var(--surface-2); border: 1px solid var(--border); padding: 0.08rem 0.35rem;
border-radius: 4px; font-family: var(--font-mono); font-size: 0.84em; }
.md pre { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius);
padding: 0.85rem 1rem; overflow-x: auto; margin: 0.9rem 0; }
.md pre code { background: none; border: none; padding: 0; font-size: 0.83rem; line-height: 1.55; }
.src pre { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius);
padding: 1rem 1.1rem; overflow-x: auto; font-family: var(--font-mono);
font-size: 0.82rem; line-height: 1.55; }
.src .k { color: var(--code-k); } .src .s { color: var(--code-s); }
.src .c { color: var(--code-c); font-style: italic; } .src .n { color: var(--code-n); }
.src-meta { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem;
flex-wrap: wrap; margin-bottom: 0.6rem; color: var(--text-dim); font-size: 0.85rem; }
.src-meta code { font-family: var(--font-mono); font-size: 0.82rem; }
.lightbox { border: 0; margin: 0; padding: 2rem; width: 100%; height: 100%; max-width: none;
max-height: none; background: rgba(0,0,0,0.85); cursor: zoom-out; }
.lightbox[open] { display: flex; align-items: center; justify-content: center; }
.lightbox::backdrop { background: transparent; }
.lightbox img { max-width: 100%; max-height: 100%; border-radius: var(--radius); }
.lightbox-close { position: absolute; top: 0.9rem; right: 0.9rem; background: var(--surface-2);
color: var(--text); border: 1px solid var(--border); border-radius: var(--radius);
font: 500 0.8rem var(--font-sans); padding: 0.4rem 0.75rem; cursor: pointer; }
.lightbox-close:hover { border-color: var(--select); color: var(--select); }
footer { border-top: 1px solid var(--border); background: var(--surface); margin-top: 2rem; }
footer .statusbar { max-width: var(--maxw); margin: 0 auto; padding: 0.55rem 1.25rem;
display: flex; align-items: center; gap: 1rem; flex-wrap: wrap;
font-family: var(--font-mono); font-size: 0.6875rem; letter-spacing: 0.04em;
text-transform: uppercase; color: var(--text-dim); }
footer .statusbar code { font-family: inherit; text-transform: none; }
@media (min-width: 720px) { .grid { grid-template-columns: 1fr 1fr; gap: 1.75rem; } }
@media (min-width: 560px) { html.density-compact .grid { grid-template-columns: 1fr 1fr; gap: 1rem; } }
@media (min-width: 900px) { html.density-compact .grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 1560px) {
html.density-compact .controls-inner,
html.density-compact main { max-width: 1400px; }
html.density-compact .grid { grid-template-columns: repeat(4, 1fr); }
}
@media (prefers-reduced-motion: reduce) {
html { scroll-behavior: auto; }
.card { transition: none; }
.card:hover { transform: none; }
.to-top { transition: none; }
}
</style>
</head>
<body>
<a class="skip" href="#main">Skip to content</a>
<div class="topbar">
<a class="back" href="../"><span aria-hidden="true">←</span> Examples and Showcase</a>
<div class="topbar-right">
<a class="ghlink" href="https://github.com/TMHSDigital/Blender-Developer-Tools">GitHub</a>
</div>
</div>
<header class="hero">
<h1>compositor-glare</h1>
<p>Bloom where it actually lives — a compositor Glare (Fog Glow) node fed by Render Layers, wired via scene.compositing_node_group on 5.x and scene.node_tree on 4.x, with the Glare node's legacy properties vs 5.x menu sockets.</p>
</header>
<main id="main">
<button class="detail-hero" id="heroZoom" type="button" aria-label="Zoom compositor-glare render">
<img src="../assets/compositor-glare-hero.webp" alt="compositor-glare render" width="1280" height="720" />
</button>
<p class="zoom-hint">Rendered headless by the example itself — click to zoom.</p>
<div class="callout"><span class="tag">witnesses</span> scene.node_tree is gone in 5.x and EEVEE has no use_bloom on either side: the halo beyond the ring silhouette falls off strictly with the compositor on and is exactly zero with it off.</div>
<div class="runline">
<pre id="runCmd">blender --background --python examples/compositor-glare/compositor_glare.py --</pre>
<button class="copy-btn" id="copyRun" type="button">Copy</button>
</div>
<section class="detail-section md">
<p>A runnable example that puts bloom where it actually lives: the compositor. Three emissive rings are rendered, then a <code>Glare</code> (Fog Glow) node fed by <code>Render Layers</code> grows the halo — wired through <code>scene.compositing_node_group</code> on Blender 5.x and through <code>scene.node_tree</code> on 4.x, because the 5.0 compositor rewrite removed the scene-level tree entirely (<code>scene.use_nodes = True</code> now raises <code>AttributeError</code>).</p>
<p>The Glare node changed shape with it: on 4.x it takes legacy enum properties (<code>glare_type='FOG_GLOW'</code>, <code>quality='HIGH'</code>, <code>size=6</code>), while on 5.x the same choices are menu/float <strong>input sockets</strong> (<code>inputs['Type'].default_value = 'Fog Glow'</code>). The 4.x <code>threshold</code> property is a dead shim — the real threshold is the <code>Threshold</code> input socket on both versions. And EEVEE has no <code>use_bloom</code> toggle on either version (removed in 4.2): bloom is a compositor node, period.</p>
<p><strong>What it witnesses:</strong> the halo is the compositor's output, proven with pixels. The check renders the scene twice at 96×54 (single-sample Cycles, noise-free) — once with <code>use_compositing</code> on, once off — and samples a column of pixels above the middle ring's silhouette via <code>world_to_camera_view</code>. With the compositor on, the halo luminance just outside the silhouette is far above zero and falls off strictly with distance (the Fog Glow kernel signature); with it off, those same pixels are exactly zero. The structural check pins the wiring (<code>Render Layers → Glare → output</code>), the version-correct tree plumbing, and the absence of any EEVEE bloom toggle.</p>
<h2>Run</h2>
<pre><code># Cheap correctness check (two tiny renders) — the CI check:
blender --background --python compositor_glare.py --
# Falsifier: Threshold=10.0. Must exit non-zero (Threshold==1.0).
blender --background --python compositor_glare.py -- --threshold-high
# Also render a still (EEVEE on a GPU host; use --engine cycles on GPU-less hosts):
blender --background --python compositor_glare.py -- --output rings.png
blender --background --python compositor_glare.py -- --output rings.png --engine cycles</code></pre>
<h2>Exit codes</h2>
<p>Per-script sequential checks. <code>9</code> is a valid check code; there is no rule against it.</p>
<div class="table-wrap"><table><thead><tr><th scope="col">Code</th><th scope="col">Meaning</th></tr></thead><tbody><tr><td>0</td><td>Success</td></tr><tr><td>1</td><td>Uncaught exception (FATAL wrapper)</td></tr><tr><td>2</td><td>argparse / usage</td></tr><tr><td>3</td><td>Compositor tree / Glare / Threshold / link-chain contract (<code>--threshold-high</code> lands here)</td></tr><tr><td>4</td><td>Check render missing, tube dark, no halo, or halo does not fall off</td></tr><tr><td>5</td><td>Halo present with compositing off</td></tr><tr><td>6</td><td><code>--output</code> produced no file</td></tr></tbody></table></div>
<p>The <code>blender-smoke</code> workflow runs the check on Blender 5.2 LTS and 4.5 LTS (5.1 on the weekly cron, the <code>needs-5.1</code> PR label, or manual dispatch). Smoke does not pass <code>--output</code> or <code>--threshold-high</code>.</p>
</section>
<section class="detail-section src">
<h2>Source</h2>
<div class="src-meta">
<code>examples/compositor-glare/compositor_glare.py</code>
<a href="https://github.com/TMHSDigital/Blender-Developer-Tools/tree/main/examples/compositor-glare/compositor_glare.py">View on GitHub →</a>
</div>
<pre><span class="s">"""Bloom through the compositor across the 4.x -> 5.x boundary — a runnable example.
Witnesses the compositor-plumbing contract that AI-generated Blender code breaks
constantly:
- Blender 5.x removed `scene.node_tree` / `scene.use_nodes`: the scene compositor
is now a node GROUP assigned to `scene.compositing_node_group`, with an
`Image` output declared via `tree.interface.new_socket`. The old one-liner
`scene.use_nodes = True` raises AttributeError on 5.x.
- The Glare node itself changed shape: on 4.x it is configured with legacy enum
properties (`glare_type='FOG_GLOW'`, `quality='HIGH'`, `size=6`); on 5.x the
same choices are menu/float INPUT sockets (`inputs['Type'].default_value =
'Fog Glow'`). The legacy `threshold` property is a dead shim on 4.x — the real
threshold lives in the `Threshold` input socket on BOTH versions.
- EEVEE has no `use_bloom` toggle on either version (removed in 4.2). Bloom is
a compositor node, and the check proves it with pixels: a halo appears beyond
the ring silhouette, falls off strictly with distance, and vanishes entirely
when `scene.render.use_compositing` is off.
``--threshold-high`` sets the shared ``Threshold`` input to 10.0 and still
asserts it equals 1.0. That is the falsifier (``--same-axis`` in
export-preset-axis). The 4.x/5.x Type-menu shim is untouched.
By default it runs only the correctness check (two 96x54 single-sample Cycles
renders, compositor on vs off) — the CI smoke check. Pass --output to also
render a still:
blender --background --python compositor_glare.py -- # check only
blender --background --python compositor_glare.py -- --threshold-high # must fail
blender --background --python compositor_glare.py -- --output n.png # + render
"""</span>
<span class="k">import</span> bpy
<span class="k">import</span> sys
<span class="k">import</span> os
<span class="k">import</span> math
<span class="k">import</span> tempfile
<span class="k">import</span> argparse
<span class="k">from</span> bpy_extras.object_utils <span class="k">import</span> world_to_camera_view
<span class="k">from</span> mathutils <span class="k">import</span> Vector
RING_MAJOR = <span class="n">0.7</span>
RING_MINOR = <span class="n">0.12</span>
RING_Z = <span class="n">0.85</span> <span class="c"># ring center height; bottom edge grazes the floor</span>
RING_SPECS = ( <span class="c"># three neon rings standing in the XZ plane (name, x, y, color, strength)</span>
(<span class="s">"RingViolet"</span>, -<span class="n">1.55</span>, <span class="n">0.55</span>, (<span class="n">0.55</span>, <span class="n">0.15</span>, <span class="n">1.0</span>, <span class="n">1.0</span>), <span class="n">12.0</span>),
(<span class="s">"RingCyan"</span>, <span class="n">0.0</span>, <span class="n">0.0</span>, (<span class="n">0.10</span>, <span class="n">0.90</span>, <span class="n">1.0</span>, <span class="n">1.0</span>), <span class="n">18.0</span>), <span class="c"># the ring the check samples</span>
(<span class="s">"RingAmber"</span>, <span class="n">1.55</span>, <span class="n">0.45</span>, (<span class="n">1.00</span>, <span class="n">0.45</span>, <span class="n">0.08</span>, <span class="n">1.0</span>), <span class="n">9.0</span>),
)
CHECK_W, CHECK_H = <span class="n">96</span>, <span class="n">54</span> <span class="c"># tiny, noise-free: 1-sample Cycles, pure emission</span>
<span class="k">def</span> eevee_engine_id():
<span class="k">return</span> <span class="s">'BLENDER_EEVEE'</span> <span class="k">if</span> bpy.app.version >= (<span class="n">5</span>, <span class="n">0</span>, <span class="n">0</span>) <span class="k">else</span> <span class="s">'BLENDER_EEVEE_NEXT'</span>
<span class="k">def</span> make_emissive(name, color, strength):
mat = bpy.data.materials.new(name)
mat.use_nodes = <span class="k">True</span>
nt = mat.node_tree
nt.nodes.clear()
emis = nt.nodes.new(<span class="s">'ShaderNodeEmission'</span>)
emis.inputs[<span class="s">'Color'</span>].default_value = color
emis.inputs[<span class="s">'Strength'</span>].default_value = strength
out = nt.nodes.new(<span class="s">'ShaderNodeOutputMaterial'</span>)
nt.links.new(emis.outputs[<span class="s">'Emission'</span>], out.inputs[<span class="s">'Surface'</span>])
<span class="k">return</span> mat
<span class="k">def</span> configure_fog_glow(glare):
<span class="s">"""Same Fog Glow on both sides of the 5.0 compositor rewrite.
4.x: legacy enum properties; `size` is the old kernel int and the real
threshold is the `Threshold` input socket (the `threshold` property is a
dead shim — it always reads 0.0 on 4.5).
5.x: `glare_type`/`quality`/`size` properties are gone; Type and Quality
are menu sockets that take their DISPLAY names, Size is a 0..1 factor.
"""</span>
<span class="k">if</span> bpy.app.version >= (<span class="n">5</span>, <span class="n">0</span>, <span class="n">0</span>):
glare.inputs[<span class="s">'Type'</span>].default_value = <span class="s">'Fog Glow'</span>
glare.inputs[<span class="s">'Quality'</span>].default_value = <span class="s">'High'</span>
glare.inputs[<span class="s">'Size'</span>].default_value = <span class="n">0.85</span>
<span class="k">else</span>:
glare.glare_type = <span class="s">'FOG_GLOW'</span>
glare.quality = <span class="s">'HIGH'</span>
glare.size = <span class="n">6</span>
glare.inputs[<span class="s">'Threshold'</span>].default_value = <span class="n">1.0</span> <span class="c"># input socket on BOTH versions</span>
<span class="k">def</span> build_compositor(scene):
<span class="s">"""Wire Render Layers -> Glare (Fog Glow) -> output, cross-version.
Returns (tree, glare_node). 5.x builds a compositor node group and assigns
it to scene.compositing_node_group; 4.x uses the scene's own node tree.
"""</span>
<span class="k">if</span> bpy.app.version >= (<span class="n">5</span>, <span class="n">0</span>, <span class="n">0</span>):
tree = bpy.data.node_groups.new(<span class="s">"BloomComposite"</span>, <span class="s">'CompositorNodeTree'</span>)
tree.interface.new_socket(name=<span class="s">"Image"</span>, in_out=<span class="s">'INPUT'</span>, socket_type=<span class="s">'NodeSocketColor'</span>)
tree.interface.new_socket(name=<span class="s">"Image"</span>, in_out=<span class="s">'OUTPUT'</span>, socket_type=<span class="s">'NodeSocketColor'</span>)
out_node = tree.nodes.new(<span class="s">"NodeGroupOutput"</span>)
scene.compositing_node_group = tree
<span class="k">else</span>:
scene.use_nodes = <span class="k">True</span>
tree = scene.node_tree
tree.nodes.clear()
out_node = tree.nodes.new(<span class="s">"CompositorNodeComposite"</span>)
rl = tree.nodes.new(<span class="s">"CompositorNodeRLayers"</span>)
glare = tree.nodes.new(<span class="s">"CompositorNodeGlare"</span>)
configure_fog_glow(glare)
tree.links.new(rl.outputs[<span class="s">"Image"</span>], glare.inputs[<span class="s">"Image"</span>])
tree.links.new(glare.outputs[<span class="s">"Image"</span>], out_node.inputs[<span class="s">"Image"</span>])
<span class="k">return</span> tree, glare
<span class="k">def</span> build_scene():
bpy.ops.wm.read_factory_settings(use_empty=<span class="k">True</span>)
scene = bpy.context.scene
<span class="k">for</span> name, x, y, color, strength <span class="k">in</span> RING_SPECS:
bpy.ops.mesh.primitive_torus_add(
major_radius=RING_MAJOR, minor_radius=RING_MINOR,
major_segments=<span class="n">64</span>, minor_segments=<span class="n">16</span>,
location=(x, y, RING_Z), rotation=(math.radians(<span class="n">90</span>), <span class="n">0.0</span>, <span class="n">0.0</span>))
ring = bpy.context.active_object
ring.name = name
ring.data.materials.append(make_emissive(<span class="s">f"</span><span class="s">Neon</span>{name[<span class="n">4</span>:]}<span class="s">"</span>, color, strength))
<span class="k">for</span> poly <span class="k">in</span> ring.data.polygons:
poly.use_smooth = <span class="k">True</span>
world = bpy.data.worlds.new(<span class="s">"World"</span>)
world.use_nodes = <span class="k">True</span>
world.node_tree.nodes[<span class="s">"Background"</span>].inputs[<span class="s">"Color"</span>].default_value = (<span class="n">0.0</span>, <span class="n">0.0</span>, <span class="n">0.0</span>, <span class="n">1.0</span>)
scene.world = world
cam_data = bpy.data.cameras.new(<span class="s">"Cam"</span>)
cam = bpy.data.objects.new(<span class="s">"Cam"</span>, cam_data)
<span class="c"># level, centered camera: the top silhouette of the middle ring is exactly</span>
<span class="c"># (0, 0, RING_Z + RING_MAJOR + RING_MINOR) with pure black world above it</span>
cam.location = (<span class="n">0.0</span>, -<span class="n">6.0</span>, RING_Z)
cam.rotation_euler = (math.radians(<span class="n">90</span>), <span class="n">0.0</span>, <span class="n">0.0</span>)
scene.collection.objects.link(cam)
scene.camera = cam
tree, glare = build_compositor(scene)
bpy.context.view_layer.update()
<span class="k">return</span> scene, tree, glare
<span class="k">def</span> link_chain_ok(tree, glare, out_node):
<span class="s">"""Every hop Render Layers -> Glare -> output must be a real link."""</span>
rl = next((n <span class="k">for</span> n <span class="k">in</span> tree.nodes <span class="k">if</span> n.bl_idname == <span class="s">"CompositorNodeRLayers"</span>), <span class="k">None</span>)
<span class="k">if</span> rl <span class="k">is</span> <span class="k">None</span>:
<span class="k">return</span> <span class="k">False</span>
hop1 = any(l.from_node == rl <span class="k">and</span> l.to_node == glare <span class="k">for</span> l <span class="k">in</span> tree.links)
hop2 = any(l.from_node == glare <span class="k">and</span> l.to_node == out_node <span class="k">for</span> l <span class="k">in</span> tree.links)
<span class="k">return</span> hop1 <span class="k">and</span> hop2
<span class="k">def</span> check_structure(scene, tree, glare):
is_5x = bpy.app.version >= (<span class="n">5</span>, <span class="n">0</span>, <span class="n">0</span>)
<span class="c"># the divergence itself: scene.node_tree exists only on 4.x</span>
<span class="k">if</span> hasattr(scene, <span class="s">"node_tree"</span>) == is_5x:
print(<span class="s">f"</span><span class="s">ERROR: scene.node_tree presence </span>{hasattr(scene, <span class="s">'node_tree'</span>)}<span class="s"> </span><span class="s">"</span>
<span class="s">f"</span><span class="s">contradicts version </span>{bpy.app.version_string}<span class="s">"</span>, file=sys.stderr)
<span class="k">return</span> <span class="n">3</span>
<span class="k">if</span> is_5x:
<span class="k">if</span> scene.compositing_node_group != tree:
print(<span class="s">"ERROR: compositing_node_group is not the tree we built"</span>, file=sys.stderr)
<span class="k">return</span> <span class="n">3</span>
outs = [s <span class="k">for</span> s <span class="k">in</span> tree.interface.items_tree
<span class="k">if</span> getattr(s, <span class="s">"in_out"</span>, <span class="k">None</span>) == <span class="s">'OUTPUT'</span> <span class="k">and</span> s.name == <span class="s">"Image"</span>]
<span class="k">if</span> <span class="k">not</span> outs:
print(<span class="s">"ERROR: compositor group has no Image output socket"</span>, file=sys.stderr)
<span class="k">return</span> <span class="n">3</span>
out_node = next(n <span class="k">for</span> n <span class="k">in</span> tree.nodes <span class="k">if</span> n.bl_idname == <span class="s">"NodeGroupOutput"</span>)
<span class="k">if</span> glare.inputs[<span class="s">'Type'</span>].default_value != <span class="s">'Fog Glow'</span>:
print(<span class="s">"ERROR: 5.x Glare Type menu is not 'Fog Glow'"</span>, file=sys.stderr)
<span class="k">return</span> <span class="n">3</span>
<span class="k">else</span>:
out_node = next(n <span class="k">for</span> n <span class="k">in</span> tree.nodes <span class="k">if</span> n.bl_idname == <span class="s">"CompositorNodeComposite"</span>)
<span class="k">if</span> <span class="k">not</span> (glare.glare_type == <span class="s">'FOG_GLOW'</span> <span class="k">and</span> glare.quality == <span class="s">'HIGH'</span> <span class="k">and</span> glare.size == <span class="n">6</span>):
print(<span class="s">"ERROR: 4.x Glare legacy properties not as configured"</span>, file=sys.stderr)
<span class="k">return</span> <span class="n">3</span>
<span class="k">if</span> glare.inputs[<span class="s">'Threshold'</span>].default_value != <span class="n">1.0</span>:
print(<span class="s">"ERROR: Glare Threshold input != 1.0"</span>, file=sys.stderr)
<span class="k">return</span> <span class="n">3</span>
<span class="k">if</span> <span class="k">not</span> link_chain_ok(tree, glare, out_node):
print(<span class="s">"ERROR: Render Layers -> Glare -> output link chain broken"</span>, file=sys.stderr)
<span class="k">return</span> <span class="n">3</span>
<span class="c"># negative witness: bloom cannot come from EEVEE on either version</span>
<span class="k">if</span> getattr(getattr(scene, <span class="s">"eevee"</span>, <span class="k">None</span>), <span class="s">"use_bloom"</span>, <span class="k">None</span>) <span class="k">is</span> <span class="k">not</span> <span class="k">None</span>:
print(<span class="s">"ERROR: unexpected EEVEE use_bloom toggle — the example's premise is stale"</span>,
file=sys.stderr)
<span class="k">return</span> <span class="n">3</span>
<span class="k">return</span> <span class="n">0</span>
<span class="k">def</span> render_frame(scene, path, use_compositing):
scene.render.engine = <span class="s">'CYCLES'</span>
scene.cycles.samples = <span class="n">1</span>
scene.cycles.use_denoising = <span class="k">False</span>
scene.render.resolution_x = CHECK_W
scene.render.resolution_y = CHECK_H
scene.render.resolution_percentage = <span class="n">100</span>
scene.render.image_settings.file_format = <span class="s">'PNG'</span>
scene.render.use_compositing = use_compositing
scene.render.filepath = path
bpy.ops.render.render(write_still=<span class="k">True</span>)
<span class="k">return</span> os.path.exists(path) <span class="k">and</span> os.path.getsize(path) > <span class="n">0</span>
<span class="k">def</span> sample_column(scene, path):
<span class="s">"""Luminance (R+G+B) on the middle ring's tube, then marching up in image
space from its top silhouette pixel: the halo profile of the bloom kernel."""</span>
img = bpy.data.images.load(path)
w, h = img.size
<span class="k">if</span> (w, h) != (CHECK_W, CHECK_H):
bpy.data.images.remove(img)
<span class="k">raise</span> RuntimeError(<span class="s">f"</span><span class="s">reloaded </span>{path}<span class="s"> at </span>{(w, h)}<span class="s">, expected </span>{(CHECK_W, CHECK_H)}<span class="s">"</span>)
px = img.pixels[:]
bpy.data.images.remove(img)
<span class="k">def</span> lum(x, y):
x, y = max(<span class="n">0</span>, min(w - <span class="n">1</span>, x)), max(<span class="n">0</span>, min(h - <span class="n">1</span>, y))
i = (y * w + x) * <span class="n">4</span>
<span class="k">return</span> px[i] + px[i + <span class="n">1</span>] + px[i + <span class="n">2</span>]
<span class="k">def</span> project(co):
ndc = world_to_camera_view(scene, scene.camera, Vector(co))
<span class="k">return</span> int(ndc.x * w), int(ndc.y * h)
on_x, on_y = project((<span class="n">0.0</span>, <span class="n">0.0</span>, RING_Z + RING_MAJOR)) <span class="c"># on the tube</span>
sil_x, sil_y = project((<span class="n">0.0</span>, <span class="n">0.0</span>, RING_Z + RING_MAJOR + RING_MINOR)) <span class="c"># silhouette</span>
<span class="k">return</span> (lum(on_x, on_y), [lum(sil_x, sil_y + d) <span class="k">for</span> d <span class="k">in</span> (<span class="n">1</span>, <span class="n">2</span>, <span class="n">3</span>)])
<span class="k">def</span> check_pixels(scene):
tmp = tempfile.mkdtemp(prefix=<span class="s">"compositor_glare_"</span>)
<span class="k">try</span>:
on_path = os.path.join(tmp, <span class="s">"on.png"</span>)
off_path = os.path.join(tmp, <span class="s">"off.png"</span>)
<span class="k">if</span> <span class="k">not</span> render_frame(scene, on_path, <span class="k">True</span>):
print(<span class="s">"ERROR: compositor-on check render produced no file"</span>, file=sys.stderr)
<span class="k">return</span> <span class="n">4</span>
<span class="k">if</span> <span class="k">not</span> render_frame(scene, off_path, <span class="k">False</span>):
print(<span class="s">"ERROR: compositor-off check render produced no file"</span>, file=sys.stderr)
<span class="k">return</span> <span class="n">4</span>
tube_on, halo_on = sample_column(scene, on_path)
tube_off, halo_off = sample_column(scene, off_path)
<span class="k">if</span> tube_on < <span class="n">1.5</span> <span class="k">or</span> tube_off < <span class="n">1.5</span>:
print(<span class="s">f"</span><span class="s">ERROR: ring tube not bright (on=</span>{tube_on:<span class="s">.3f</span>}<span class="s"> off=</span>{tube_off:<span class="s">.3f</span>}<span class="s">)</span><span class="s">"</span>,
file=sys.stderr)
<span class="k">return</span> <span class="n">4</span>
<span class="k">if</span> halo_on[<span class="n">0</span>] < <span class="n">0.10</span>:
print(<span class="s">f"</span><span class="s">ERROR: no bloom halo beyond the silhouette (halo+1px=</span>{halo_on[<span class="n">0</span>]:<span class="s">.3f</span>}<span class="s">)</span><span class="s">"</span>,
file=sys.stderr)
<span class="k">return</span> <span class="n">4</span>
<span class="k">if</span> <span class="k">not</span> (halo_on[<span class="n">0</span>] > halo_on[<span class="n">1</span>] > halo_on[<span class="n">2</span>]):
print(<span class="s">f"</span><span class="s">ERROR: halo does not fall off strictly: </span><span class="s">"</span>
<span class="s">f"</span>{[<span class="s">'%.3f'</span> % v <span class="k">for</span> v <span class="k">in</span> halo_on]}<span class="s">"</span>, file=sys.stderr)
<span class="k">return</span> <span class="n">4</span>
<span class="k">if</span> max(halo_off) > <span class="n">0.02</span>:
print(<span class="s">f"</span><span class="s">ERROR: halo present WITHOUT the compositor </span><span class="s">"</span>
<span class="s">f"</span><span class="s">(</span>{[<span class="s">'%.3f'</span> % v <span class="k">for</span> v <span class="k">in</span> halo_off]}<span class="s">) — bloom is not from the Glare node</span><span class="s">"</span>,
file=sys.stderr)
<span class="k">return</span> <span class="n">5</span>
print(<span class="s">f"</span><span class="s">pixels: tube=</span>{tube_on:<span class="s">.3f</span>}<span class="s"> halo(+1/+2/+3px)=</span><span class="s">"</span>
<span class="s">f"</span>{<span class="s">'/'</span>.join(<span class="s">'%.3f'</span> % v <span class="k">for</span> v <span class="k">in</span> halo_on)}<span class="s"> </span><span class="s">"</span>
<span class="s">f"</span><span class="s">compositor-off halo max=</span>{max(halo_off):<span class="s">.3f</span>}<span class="s">"</span>)
<span class="k">return</span> <span class="n">0</span>
<span class="k">finally</span>:
<span class="k">for</span> f <span class="k">in</span> (<span class="s">"on.png"</span>, <span class="s">"off.png"</span>):
p = os.path.join(tmp, f)
<span class="k">if</span> os.path.exists(p):
os.remove(p)
os.rmdir(tmp)
<span class="k">def</span> render_still(scene, path, engine, samples, width):
<span class="s">"""Dark-studio beauty pass: the same rings, now grounded on a reflective
floor — the glow and its reflection are the compositor's doing."""</span>
<span class="c"># glossy dark floor stays below the bloom threshold; only the rings bloom</span>
mesh = bpy.data.meshes.new(<span class="s">"Floor"</span>)
half = <span class="n">30.0</span>
mesh.from_pydata([(-half, -half, <span class="n">0.0</span>), (half, -half, <span class="n">0.0</span>),
(half, half, <span class="n">0.0</span>), (-half, half, <span class="n">0.0</span>)], [], [(<span class="n">0</span>, <span class="n">1</span>, <span class="n">2</span>, <span class="n">3</span>)])
fmat = bpy.data.materials.new(<span class="s">"Studio"</span>)
fmat.use_nodes = <span class="k">True</span>
fb = fmat.node_tree.nodes[<span class="s">"Principled BSDF"</span>]
fb.inputs[<span class="s">"Base Color"</span>].default_value = (<span class="n">0.04</span>, <span class="n">0.045</span>, <span class="n">0.055</span>, <span class="n">1.0</span>)
fb.inputs[<span class="s">"Roughness"</span>].default_value = <span class="n">0.25</span>
fb.inputs[<span class="s">"Metallic"</span>].default_value = <span class="n">0.6</span>
mesh.materials.append(fmat)
floor = bpy.data.objects.new(<span class="s">"Floor"</span>, mesh)
scene.collection.objects.link(floor)
<span class="k">def</span> light(name, loc, energy, size, col, rot):
ld = bpy.data.lights.new(name, <span class="s">'AREA'</span>)
ld.energy = energy
ld.size = size
ld.color = col
ob = bpy.data.objects.new(name, ld)
ob.location = loc
ob.rotation_euler = tuple(math.radians(a) <span class="k">for</span> a <span class="k">in</span> rot)
scene.collection.objects.link(ob)
light(<span class="s">"Key"</span>, (-<span class="n">4.5</span>, -<span class="n">4.0</span>, <span class="n">5.5</span>), <span class="n">500.0</span>, <span class="n">6.0</span>, (<span class="n">0.85</span>, <span class="n">0.9</span>, <span class="n">1.0</span>), (<span class="n">50</span>, <span class="n">0</span>, -<span class="n">30</span>))
light(<span class="s">"Fill"</span>, (<span class="n">4.5</span>, -<span class="n">3.0</span>, <span class="n">2.5</span>), <span class="n">300.0</span>, <span class="n">8.0</span>, (<span class="n">1.0</span>, <span class="n">0.85</span>, <span class="n">0.7</span>), (<span class="n">65</span>, <span class="n">0</span>, <span class="n">40</span>))
<span class="c"># a slightly elevated, centered camera for the still — all three rings in</span>
<span class="c"># frame with headroom for the glow, floor reflection anchoring the bottom</span>
cam = scene.camera
cam.location = (<span class="n">0.0</span>, -<span class="n">8.4</span>, <span class="n">2.0</span>)
cam.rotation_euler = (math.radians(<span class="n">79</span>), <span class="n">0.0</span>, <span class="n">0.0</span>)
scene.render.engine = <span class="s">'CYCLES'</span> <span class="k">if</span> engine == <span class="s">'cycles'</span> <span class="k">else</span> eevee_engine_id()
<span class="k">if</span> engine == <span class="s">'cycles'</span>:
scene.cycles.samples = samples
scene.cycles.use_denoising = <span class="k">True</span>
<span class="k">else</span>:
<span class="k">try</span>:
scene.eevee.taa_render_samples = samples
scene.eevee.use_raytracing = <span class="k">True</span>
<span class="k">except</span> AttributeError:
<span class="k">pass</span>
scene.render.resolution_x = width
scene.render.resolution_y = int(width * <span class="n">9</span> / <span class="n">16</span>)
scene.render.resolution_percentage = <span class="n">100</span>
scene.render.image_settings.file_format = <span class="s">'WEBP'</span> <span class="k">if</span> path.lower().endswith(<span class="s">".webp"</span>) <span class="k">else</span> <span class="s">'PNG'</span>
scene.render.use_compositing = <span class="k">True</span>
scene.render.filepath = path
bpy.ops.render.render(write_still=<span class="k">True</span>)
<span class="k">return</span> os.path.exists(path) <span class="k">and</span> os.path.getsize(path) > <span class="n">0</span>
<span class="k">def</span> main():
argv = sys.argv[sys.argv.index(<span class="s">"--"</span>) + <span class="n">1</span>:] <span class="k">if</span> <span class="s">"--"</span> <span class="k">in</span> sys.argv <span class="k">else</span> []
p = argparse.ArgumentParser()
p.add_argument(<span class="s">"--output"</span>, default=<span class="k">None</span>, help=<span class="s">"optional: render a still here (.png or .webp)"</span>)
p.add_argument(<span class="s">"--engine"</span>, default=<span class="s">"eevee"</span>, choices=(<span class="s">"eevee"</span>, <span class="s">"cycles"</span>),
help=<span class="s">"render engine for --output (cycles for GPU-less hosts)"</span>)
p.add_argument(<span class="s">"--samples"</span>, type=int, default=<span class="n">32</span>, help=<span class="s">"--output sample count"</span>)
p.add_argument(<span class="s">"--width"</span>, type=int, default=<span class="n">1280</span>, help=<span class="s">"--output width; height is width*9/16"</span>)
p.add_argument(<span class="s">"--threshold-high"</span>, action=<span class="s">"store_true"</span>,
help=<span class="s">"falsifier: Threshold=10.0, still assert Threshold==1.0"</span>)
args = p.parse_args(argv)
scene, tree, glare = build_scene()
<span class="k">if</span> args.threshold_high:
glare.inputs[<span class="s">'Threshold'</span>].default_value = <span class="n">10.0</span>
code = check_structure(scene, tree, glare)
<span class="k">if</span> code:
<span class="k">return</span> code
print(<span class="s">f"</span><span class="s">structure OK on </span>{bpy.app.version_string}<span class="s">: </span><span class="s">"</span>
<span class="s">f"</span>{<span class="s">'compositing_node_group'</span> <span class="k">if</span> bpy.app.version >= (<span class="n">5</span>, <span class="n">0</span>, <span class="n">0</span>) <span class="k">else</span> <span class="s">'scene.node_tree'</span>}<span class="s"> </span><span class="s">"</span>
<span class="s">f"</span><span class="s">-> Glare(Fog Glow) -> output; no EEVEE use_bloom</span><span class="s">"</span>)
code = check_pixels(scene)
<span class="k">if</span> code:
<span class="k">return</span> code
<span class="k">if</span> args.output:
<span class="k">if</span> <span class="k">not</span> render_still(scene, os.path.abspath(args.output), args.engine, args.samples,
args.width):
print(<span class="s">"ERROR: render produced no file"</span>, file=sys.stderr)
<span class="k">return</span> <span class="n">6</span>
print(<span class="s">f"</span><span class="s">rendered still </span>{args.output}<span class="s">"</span>)
print(<span class="s">"compositor-glare OK"</span>)
<span class="k">return</span> <span class="n">0</span>
<span class="k">if</span> __name__ == <span class="s">"__main__"</span>:
<span class="k">try</span>:
sys.exit(main())
<span class="k">except</span> Exception <span class="k">as</span> e:
<span class="k">import</span> traceback; traceback.print_exc(); print(<span class="s">f"</span><span class="s">FATAL: </span>{e}<span class="s">"</span>, file=sys.stderr); sys.exit(<span class="n">1</span>)
</pre>
</section>
</main>
<dialog class="lightbox" id="lightbox" aria-label="Full-size render">
<button class="lightbox-close" type="button" autofocus>Close</button>
<img src="../assets/compositor-glare-hero.webp" alt="compositor-glare render, full size" />
</dialog>
<footer>
<div class="statusbar">
<span>generated from <code>examples/gallery.json</code></span>
<span>CC-BY-NC-ND-4.0</span>
<span style="color: var(--ok);">exit 0</span>
</div>
</footer>
<script>
(function () {
var hero = document.getElementById('heroZoom');
var box = document.getElementById('lightbox');
if (hero && box) {
// <dialog>.showModal() traps focus, closes on Escape, and returns
// focus to the hero button on close. Any click inside closes it.
hero.addEventListener('click', function () { box.showModal(); });
box.addEventListener('click', function () { box.close(); });
}
var copy = document.getElementById('copyRun');
if (copy) {
copy.addEventListener('click', function () {
var cmd = document.getElementById('runCmd').textContent;
navigator.clipboard.writeText(cmd).then(function () {
copy.textContent = 'Copied!';
setTimeout(function () { copy.textContent = 'Copy'; }, 1500);
});
});
}
})();
</script>
</body>
</html>