1#!/usr/bin/env python3
2"""Fusion Render Node (sg render) conformance probe generator & comparator.
3
4Generates compact multi-frame .comp files, renders ground truth on Snow Globe's RTX 3090 via
5`sg render` (using /Volumes/clover directly if mounted, or sg upload/download to /srv/clover),
6and compares every frame against our `target/release/render-check`.
7"""
8
9import math
10import os
11import struct
12import subprocess
13import sys
14import zlib
15from pathlib import Path
16
17SMB_ROOT = Path("/Volumes/clover/Project/CloverCompositor/probes")
18REMOTE_ROOT = "/srv/clover/Project/CloverCompositor/probes"
19CONTAINER_ROOT = "/Volumes/clover/Project/CloverCompositor/probes"
20LOCAL_FALLBACK = Path(
21 "/Users/clo/.knife/agent/gemini-roPs/antigravity-cli/brain/d42ef021-5bce-4812-b5e5-1e3ed7ce6c77/scratch/probes"
22)
23REPO = Path("/Users/clo/dev/compositor")
24RENDER_CHECK = REPO / "target/release/render-check"
25
26
27def use_smb() -> bool:
28 return SMB_ROOT.parent.exists()
29
30
31def local_root() -> Path:
32 return SMB_ROOT if use_smb() else LOCAL_FALLBACK
33
34
35def ensure_dirs():
36 r = local_root()
37 for sub in ("comps", "assets", "gt", "ours"):
38 (r / sub).mkdir(parents=True, exist_ok=True)
39
40
41def write_png_rgba(path: Path, w: int, h: int, rgba_bytes: bytes):
42 def chunk(tag: bytes, data: bytes) -> bytes:
43 return struct.pack(">I", len(data)) + tag + data + struct.pack(">I", zlib.crc32(tag + data) & 0xFFFFFFFF)
44
45 raw = bytearray()
46 stride = w * 4
47 for y in range(h):
48 raw.append(0)
49 raw.extend(rgba_bytes[y * stride : (y + 1) * stride])
50
51 ihdr = struct.pack(">IIBBBBB", w, h, 8, 6, 0, 0, 0)
52 png = (
53 b"\x89PNG\r\n\x1a\n"
54 + chunk(b"IHDR", ihdr)
55 + chunk(b"IDAT", zlib.compress(bytes(raw), level=6))
56 + chunk(b"IEND", b"")
57 )
58 path.write_bytes(png)
59
60
61def hsv_to_rgb(h: float, s: float, v: float):
62 h = (h % 1.0) * 6.0
63 i = int(h)
64 f = h - i
65 p = v * (1.0 - s)
66 q = v * (1.0 - s * f)
67 t = v * (1.0 - s * (1.0 - f))
68 return [(v, t, p), (q, v, p), (p, v, t), (p, q, v), (t, p, v), (v, p, q)][i % 6]
69
70
71def sync_asset(local_path: Path):
72 if not use_smb():
73 subprocess.run(["sg", "upload", str(local_path), f"{REMOTE_ROOT}/assets/{local_path.name}"], check=True)
74
75
76def generate_color_chart() -> str:
77 """Straight-alpha PNG color chart (512x512)."""
78 p = local_root() / "assets" / "color_chart.png"
79 if p.exists() and p.stat().st_size > 1000:
80 return f"{CONTAINER_ROOT}/assets/color_chart.png"
81 w, h = 512, 512
82 buf = bytearray(w * h * 4)
83 for y in range(h):
84 ny = y / (h - 1)
85 for x in range(w):
86 nx = x / (w - 1)
87 r, g, b, a = 0.0, 0.0, 0.0, 1.0
88 if ny < 0.45:
89 r, g, b = hsv_to_rgb(nx, ny / 0.45, 0.85)
90 elif ny < 0.70:
91 t = (ny - 0.45) / 0.25
92 wave = 0.5 + 0.5 * math.sin(nx * 25.0 + ny * 40.0)
93 r, g, b = hsv_to_rgb(0.62 + 0.08 * math.sin(nx * 6.0), 0.08 + 0.25 * t * (0.4 + 0.6 * wave), 0.78 + 0.20 * (1.0 - t))
94 elif ny < 0.85:
95 if nx < 0.5:
96 g0 = nx * 2.0
97 r, g, b = g0, g0, g0
98 else:
99 r, g, b = hsv_to_rgb((nx - 0.5) * 2.0, 1.0, 0.35 + 0.65 * ((ny - 0.70) / 0.15))
100 else:
101 r, g, b = hsv_to_rgb(nx, 0.9, 0.9)
102 a = 1.0 - (ny - 0.85) / 0.15
103 idx = (y * w + x) * 4
104 buf[idx] = max(0, min(255, int(round(r * 255))))
105 buf[idx + 1] = max(0, min(255, int(round(g * 255))))
106 buf[idx + 2] = max(0, min(255, int(round(b * 255))))
107 buf[idx + 3] = max(0, min(255, int(round(a * 255))))
108 write_png_rgba(p, w, h, bytes(buf))
109 sync_asset(p)
110 return f"{CONTAINER_ROOT}/assets/color_chart.png"
111
112
113def generate_grid_chart() -> str:
114 """512x512 crisp colored grid + asymmetric L-shape for 3D / Transform / Displace orientation tests."""
115 p = local_root() / "assets" / "grid_chart.png"
116 if p.exists() and p.stat().st_size > 1000:
117 return f"{CONTAINER_ROOT}/assets/grid_chart.png"
118 w, h = 512, 512
119 buf = bytearray(w * h * 4)
120 for y in range(h):
121 for x in range(w):
122 r, g, b, a = 24, 28, 36, 255
123 # Colored quadrants
124 if x < 256 and y < 256:
125 r, g, b = 190, 60, 60 # top-left = red
126 elif x >= 256 and y < 256:
127 r, g, b = 60, 180, 75 # top-right = green
128 elif x < 256 and y >= 256:
129 r, g, b = 60, 95, 200 # bottom-left = blue
130 else:
131 r, g, b = 210, 180, 50 # bottom-right = yellow
132 # Grid lines every 64px
133 if x % 64 < 3 or y % 64 < 3:
134 r, g, b = 245, 245, 245
135 # Asymmetric white arrow pointing UP-RIGHT in center
136 if 220 <= x <= 290 and 120 <= y <= 380 and abs(x - 256) < 12:
137 r, g, b = 255, 255, 255
138 if 120 <= y <= 180 and abs(x - 256) < (y - 120):
139 r, g, b = 255, 255, 255
140 # Small bright square at top-left (x=64..96, y=64..96)
141 if 64 <= x < 112 and 64 <= y < 112:
142 r, g, b = 255, 255, 0
143 idx = (y * w + x) * 4
144 buf[idx:idx+4] = bytes((r, g, b, a))
145 write_png_rgba(p, w, h, bytes(buf))
146 sync_asset(p)
147 return f"{CONTAINER_ROOT}/assets/grid_chart.png"
148
149
150def step_spline(name: str, frame_values: dict) -> str:
151 kfs = []
152 for f, v in sorted(frame_values.items()):
153 kfs.append(f"\t\t\t\t[{f}] = {{ {v!r}, Flags = {{ StepIn = true }} }},")
154 return f"""\t\t{name} = BezierSpline {{
155\t\t\tKeyFrames = {{
156{chr(10).join(kfs)}
157\t\t\t}},
158\t\t}},"""
159
160
161def make_loader(name: str, container_path: str, post_mult: int = 1) -> str:
162 return f"""\t\t{name} = Loader {{
163\t\t\tClips = {{
164\t\t\t\tClip {{
165\t\t\t\t\tID = "Clip1",
166\t\t\t\t\tFilename = "{container_path}",
167\t\t\t\t\tFormatID = "PNGFormat",
168\t\t\t\t\tLength = 1,
169\t\t\t\t\tLengthSetManually = true,
170\t\t\t\t\tTrimIn = 0,
171\t\t\t\t\tTrimOut = 0,
172\t\t\t\t\tExtendFirst = 0,
173\t\t\t\t\tExtendLast = 0,
174\t\t\t\t\tLoop = 1,
175\t\t\t\t\tStartFrame = -1,
176\t\t\t\t\tGlobalStart = 0,
177\t\t\t\t\tGlobalEnd = 100,
178\t\t\t\t}},
179\t\t\t}},
180\t\t\tInputs = {{
181\t\t\t\t["Clip1.PNGFormat.PostMultiply"] = Input {{ Value = {post_mult}, }},
182\t\t\t}},
183\t\t}},"""
184
185
186def make_saver(src_op: str, prefix: str) -> str:
187 return f"""\t\tSaver1 = Saver {{
188\t\t\tInputs = {{
189\t\t\t\tClip = Input {{
190\t\t\t\t\tValue = Clip {{
191\t\t\t\t\t\tFilename = "{CONTAINER_ROOT}/gt/{prefix}_0000.png",
192\t\t\t\t\t\tFormatID = "PNGFormat",
193\t\t\t\t\t\tLength = 0,
194\t\t\t\t\t\tSaving = true,
195\t\t\t\t\t\tTrimIn = 0,
196\t\t\t\t\t\tExtendFirst = 0,
197\t\t\t\t\t\tExtendLast = 0,
198\t\t\t\t\t\tLoop = 1,
199\t\t\t\t\t\tAspectMode = 0,
200\t\t\t\t\t\tDepth = 0,
201\t\t\t\t\t\tGlobalStart = -2000000000,
202\t\t\t\t\t\tGlobalEnd = 0,
203\t\t\t\t\t}},
204\t\t\t\t}},
205\t\t\t\tOutputFormat = Input {{ Value = FuID {{ "PNGFormat" }}, }},
206\t\t\t\tInput = Input {{ SourceOp = "{src_op}", Source = "Output", }},
207\t\t\t}},
208\t\t}},"""
209
210
211def make_comp(tools_body: str, end_frame: int, w: int = 512, h: int = 512) -> str:
212 return f"""Composition {{
213\tCurrentTime = 0,
214\tRenderRange = {{ 0, {end_frame} }},
215\tGlobalRange = {{ 0, {end_frame} }},
216\tCurrentID = 200,
217\tHiQ = true,
218\tPlaybackUpdateMode = 0,
219\tVersion = "Fusion Studio 21.1 build 23",
220\tTools = ordered() {{
221{tools_body}
222\t}},
223\tPrefs = {{
224\t\tComp = {{
225\t\t\tFrameFormat = {{
226\t\t\t\tWidth = {w},
227\t\t\t\tHeight = {h},
228\t\t\t\tRate = 24,
229\t\t\t}},
230\t\t}},
231\t}},
232}}
233"""
234
235
236def build_probe_merge():
237 """Tests Merge ApplyModes + Gain (0, 0.5, 0.92, 1.0) + Operator=Under + BurnIn + SubtractiveAdditive!"""
238 chart = generate_color_chart()
239 grid = generate_grid_chart()
240 # Each case gets its own Merge node chained with Blend=1 on its frame and 0 on all other frames!
241 cases = [
242 # (frame, label, apply_mode, operator, gain, sub_add, burn_in, extra_inputs)
243 (0, "Normal_gain1.0", "Normal", "Over", 1.0, 1.0, 0.0, ""),
244 (1, "Normal_gain0.5", "Normal", "Over", 0.5, 1.0, 0.0, ""),
245 (2, "Normal_gain0.0_add", "Normal", "Over", 0.0, 1.0, 0.0, ""),
246 (3, "Normal_sub0.0_add", "Normal", "Over", 1.0, 0.0, 0.0, ""),
247 (4, "Normal_Under", "Normal", "Under", 1.0, 1.0, 0.0, ""),
248 (5, "Difference_gain1.0", "Difference", "Over", 1.0, 1.0, 0.0, ""),
249 (6, "Difference_gain0.92", "Difference", "Over", 0.92, 1.0, 0.0, ""),
250 (7, "Difference_gain0.5", "Difference", "Over", 0.5, 1.0, 0.0, ""),
251 (8, "Difference_gain0.0", "Difference", "Over", 0.0, 1.0, 0.0, ""),
252 (9, "DarkerColor_gain1.0", "DarkerColor", "Over", 1.0, 1.0, 0.0, ""),
253 (10, "DarkerColor_gain0.5", "DarkerColor", "Over", 0.5, 1.0, 0.0, ""),
254 (11, "Darken_gain1.0", "Darken", "Over", 1.0, 1.0, 0.0, ""),
255 (12, "Multiply_gain1.0", "Multiply", "Over", 1.0, 1.0, 0.0, ""),
256 (13, "Screen_gain1.0", "Screen", "Over", 1.0, 1.0, 0.0, ""),
257 (14, "Screen_gain0.5", "Screen", "Over", 0.5, 1.0, 0.0, ""),
258 (15, "LinearDodge_gain1.0", "LinearDodge", "Over", 1.0, 1.0, 0.0, ""),
259 (16, "LinearLight_gain1.0", "LinearLight", "Over", 1.0, 1.0, 0.0, ""),
260 (17, "HardLight_gain1.0", "Hard Light", "Over", 1.0, 1.0, 0.0, ""),
261 (18, "SoftLight_gain1.0", "Soft Light", "Over", 1.0, 1.0, 0.0, ""),
262 (19, "Normal_BurnIn0.5", "Normal", "Over", 1.0, 1.0, 0.5, ""),
263 ]
264
265 nodes = [
266 make_loader("BG_Loader", chart, post_mult=1),
267 make_loader("FG_Loader", grid, post_mult=1),
268 # Also make a semi-transparent FG (alpha=0.75) by merging FG over transparent or multiplying?
269 # Even better: FG_Loader has alpha=1, BG_Loader has alpha ramp at bottom — let us scale FG down to 0.85 so edges + alpha ramp both show!
270 ]
271 splines = []
272 # Chain merges on a clean BG_Loader -> Switch via Blend=1 on active frame
273 # Note: if we chain Merge_k(Background=prev, Foreground=FG_Loader, Blend=1 only on frame k), then on frame k only Merge_k runs!
274 prev = "BG_Loader"
275 for f, label, mode, op, gain, sub_add, burn_in, extra in cases:
276 bl = {c[0]: (1.0 if c[0] == f else 0.0) for c in cases}
277 sname = f"M{f}_Blend"
278 splines.append(step_spline(sname, bl))
279 nodes.append(f"""\t\tMerge_{f} = Merge {{
280\t\t\tInputs = {{
281\t\t\t\tBlend = Input {{ SourceOp = "{sname}", Source = "Value", }},
282\t\t\t\tBackground = Input {{ SourceOp = "{prev}", Source = "Output", }},
283\t\t\t\tForeground = Input {{ SourceOp = "FG_Loader", Source = "Output", }},
284\t\t\t\tSize = Input {{ Value = 0.85, }},
285\t\t\t\tApplyMode = Input {{ Value = FuID {{ "{mode}" }}, }},
286\t\t\t\tOperator = Input {{ Value = FuID {{ "{op}" }}, }},
287\t\t\t\tGain = Input {{ Value = {gain}, }},
288\t\t\t\tSubtractiveAdditive = Input {{ Value = {sub_add}, }},
289\t\t\t\tBurnIn = Input {{ Value = {burn_in}, }},
290\t\t\t\tPerformDepthMerge = Input {{ Value = 0, }},
291{extra}
292\t\t\t}},
293\t\t}},""")
294 prev = f"Merge_{f}"
295
296 nodes.append(make_saver(prev, "merge"))
297 comp_path = local_root() / "comps" / "probe_merge.comp"
298 comp_path.write_text(make_comp("\n".join(nodes + splines), len(cases) - 1))
299 return comp_path, "merge", [(c[0], c[1]) for c in cases]
300
301
302def build_probe_cam3d():
303 """Tests Camera3D RotOrder (all 6 orders!) + AoV + Shape3D Cylinder/Plane projection."""
304 grid = generate_grid_chart()
305 # 12 frames at 640x360 (16:9!):
306 # f0..f5: All 6 RotOrder values on Camera3D with (RX=15, RY=-25, RZ=12) looking at ImagePlane3D at Z=-3!
307 # f6: Exact 60_moon_guide_u f5500 camera angles (XZY, RX=11.152, RY=-16.972, RZ=0.0004) looking at vertical Shape3D Cylinder!
308 # f7: Same cylinder with RotOrder=YXZ
309 # f8: Same cylinder with RotOrder=XYZ
310 # f9: Exact 21_ground001 f2760 camera angles (XZY, RX=13.05, RY=34.09, RZ=0) looking at grid plane!
311 # f10: AoVType=1 (Horizontal) vs AoVType=0 (Vertical) check
312 # f11: Nested Transform3D with RotOrder=XZY (RX=20, RY=30, RZ=15)
313 orders = ["XYZ", "XZY", "YXZ", "YZX", "ZXY", "ZYX"]
314 cases = [
315 (0, "cam_RotOrder_XYZ"),
316 (1, "cam_RotOrder_XZY"),
317 (2, "cam_RotOrder_YXZ"),
318 (3, "cam_RotOrder_YZX"),
319 (4, "cam_RotOrder_ZXY"),
320 (5, "cam_RotOrder_ZYX"),
321 (6, "moon5500_cyl_XZY"),
322 (7, "moon5500_cyl_YXZ"),
323 (8, "moon5500_cyl_XYZ"),
324 (9, "ground2760_plane_XZY"),
325 (10, "cam_AoV_horiz_45"),
326 (11, "xf3d_RotOrder_XZY"),
327 ]
328 nodes = [make_loader("GridLoader", grid, post_mult=1)]
329 splines = []
330 # Build one Renderer3D per frame (so static RotOrder/Shape dropdowns are exact!) and switch via Merge Blend!
331 nodes.append("""\t\tBlackBG = Background {
332\t\t\tInputs = {
333\t\t\t\tWidth = Input { Value = 640, },
334\t\t\t\tHeight = Input { Value = 360, },
335\t\t\t\tTopLeftAlpha = Input { Value = 1, },
336\t\t\t},
337\t\t},""")
338 prev = "BlackBG"
339 for f, label in cases:
340 if f < 6:
341 ro = orders[f]
342 cam_rx, cam_ry, cam_rz = 15.0, -25.0, 12.0
343 cam_tz = 3.0
344 aov, aov_type = 35.0, 0
345 shape_blk = f"""\t\tPlane_{f} = ImagePlane3D {{
346\t\t\tInputs = {{
347\t\t\t\t["Transform3DOp.Scale.X"] = Input {{ Value = 2.0, }},
348\t\t\t\t["Transform3DOp.Translate.X"] = Input {{ Value = -1.2, }},
349\t\t\t\t["Transform3DOp.Translate.Y"] = Input {{ Value = 0.7, }},
350\t\t\t\tMaterialInput = Input {{ SourceOp = "GridLoader", Source = "Output", }},
351\t\t\t}},
352\t\t}},"""
353 scene_in = f"Plane_{f}"
354 elif f in (6, 7, 8):
355 ro = {6: "XZY", 7: "YXZ", 8: "XYZ"}[f]
356 cam_rx, cam_ry, cam_rz = 11.152, -16.972, 0.0004
357 cam_tz = 0.0
358 aov, aov_type = 27.99, 0
359 shape_blk = f"""\t\tCyl_{f} = Shape3D {{
360\t\t\tInputs = {{
361\t\t\t\t["SurfaceCylinderInputs.Radius"] = Input {{ Value = 100.0, }},
362\t\t\t\t["SurfaceCylinderInputs.Height"] = Input {{ Value = 150.0, }},
363\t\t\t\t["SurfaceCylinderInputs.SubdivisionLevelBase"] = Input {{ Value = 32, }},
364\t\t\t\t["SurfaceCylinderInputs.SubdivisionLevelHeight"] = Input {{ Value = 16, }},
365\t\t\t\tShape = Input {{ Value = FuID {{ "SurfaceCylinderInputs" }}, }},
366\t\t\t\t["Transform3DOp.Translate.Y"] = Input {{ Value = 30.0, }},
367\t\t\t\t["MtlStdInputs.MaterialID"] = Input {{ Value = 1, }},
368\t\t\t\tMaterialInput = Input {{ SourceOp = "GridLoader", Source = "Output", }},
369\t\t\t}},
370\t\t}},"""
371 scene_in = f"Cyl_{f}"
372 elif f == 9:
373 ro = "XZY"
374 cam_rx, cam_ry, cam_rz = 13.05, 34.09, 0.0
375 cam_tz = 0.0
376 aov, aov_type = 35.0, 0
377 shape_blk = f"""\t\tPlane_{f} = ImagePlane3D {{
378\t\t\tInputs = {{
379\t\t\t\t["Transform3DOp.Translate.X"] = Input {{ Value = -2.2, }},
380\t\t\t\t["Transform3DOp.Translate.Y"] = Input {{ Value = 0.8, }},
381\t\t\t\t["Transform3DOp.Translate.Z"] = Input {{ Value = -3.0, }},
382\t\t\t\t["Transform3DOp.Scale.X"] = Input {{ Value = 2.0, }},
383\t\t\t\tMaterialInput = Input {{ SourceOp = "GridLoader", Source = "Output", }},
384\t\t\t}},
385\t\t}},"""
386 scene_in = f"Plane_{f}"
387 elif f == 10:
388 ro = "XYZ"
389 cam_rx, cam_ry, cam_rz = 0.0, 0.0, 0.0
390 cam_tz = 3.0
391 aov, aov_type = 45.0, 1
392 shape_blk = f"""\t\tPlane_{f} = ImagePlane3D {{
393\t\t\tInputs = {{
394\t\t\t\t["Transform3DOp.Scale.X"] = Input {{ Value = 2.0, }},
395\t\t\t\tMaterialInput = Input {{ SourceOp = "GridLoader", Source = "Output", }},
396\t\t\t}},
397\t\t}},"""
398 scene_in = f"Plane_{f}"
399 else:
400 ro = "XYZ"
401 cam_rx, cam_ry, cam_rz = 0.0, 0.0, 0.0
402 cam_tz = 4.0
403 aov, aov_type = 35.0, 0
404 shape_blk = f"""\t\tPlane_{f} = ImagePlane3D {{
405\t\t\tInputs = {{
406\t\t\t\t["Transform3DOp.Scale.X"] = Input {{ Value = 2.0, }},
407\t\t\t\tMaterialInput = Input {{ SourceOp = "GridLoader", Source = "Output", }},
408\t\t\t}},
409\t\t}},
410\t\tXf3D_{f} = Transform3D {{
411\t\t\tInputs = {{
412\t\t\t\tSceneInput = Input {{ SourceOp = "Plane_{f}", Source = "Output", }},
413\t\t\t\t["Transform3DOp.Rotate.RotOrder"] = Input {{ Value = FuID {{ "XZY" }}, }},
414\t\t\t\t["Transform3DOp.Rotate.X"] = Input {{ Value = 20.0, }},
415\t\t\t\t["Transform3DOp.Rotate.Y"] = Input {{ Value = 35.0, }},
416\t\t\t\t["Transform3DOp.Rotate.Z"] = Input {{ Value = 15.0, }},
417\t\t\t}},
418\t\t}},"""
419 scene_in = f"Xf3D_{f}"
420
421 nodes.append(shape_blk)
422 nodes.append(f"""\t\tCam_{f} = Camera3D {{
423\t\t\tInputs = {{
424\t\t\t\t["Transform3DOp.Translate.Z"] = Input {{ Value = {cam_tz}, }},
425\t\t\t\t["Transform3DOp.Rotate.RotOrder"] = Input {{ Value = FuID {{ "{ro}" }}, }},
426\t\t\t\t["Transform3DOp.Rotate.X"] = Input {{ Value = {cam_rx}, }},
427\t\t\t\t["Transform3DOp.Rotate.Y"] = Input {{ Value = {cam_ry}, }},
428\t\t\t\t["Transform3DOp.Rotate.Z"] = Input {{ Value = {cam_rz}, }},
429\t\t\t\tAoV = Input {{ Value = {aov}, }},
430\t\t\t\tAoVType = Input {{ Value = {aov_type}, }},
431\t\t\t}},
432\t\t}},
433\t\tM3D_{f} = Merge3D {{
434\t\t\tInputs = {{
435\t\t\t\tSceneInput1 = Input {{ SourceOp = "{scene_in}", Source = "Output", }},
436\t\t\t\tSceneInput2 = Input {{ SourceOp = "Cam_{f}", Source = "Output", }},
437\t\t\t}},
438\t\t}},
439\t\tRen_{f} = Renderer3D {{
440\t\t\tInputs = {{
441\t\t\t\tWidth = Input {{ Value = 640, }},
442\t\t\t\tHeight = Input {{ Value = 360, }},
443\t\t\t\tSceneInput = Input {{ SourceOp = "M3D_{f}", Source = "Output", }},
444\t\t\t}},
445\t\t}},""")
446 bl = {c[0]: (1.0 if c[0] == f else 0.0) for c in cases}
447 sname = f"Sw3D_{f}_Blend"
448 splines.append(step_spline(sname, bl))
449 nodes.append(f"""\t\tSw3D_{f} = Merge {{
450\t\t\tInputs = {{
451\t\t\t\tBlend = Input {{ SourceOp = "{sname}", Source = "Value", }},
452\t\t\t\tBackground = Input {{ SourceOp = "{prev}", Source = "Output", }},
453\t\t\t\tForeground = Input {{ SourceOp = "Ren_{f}", Source = "Output", }},
454\t\t\t\tPerformDepthMerge = Input {{ Value = 0, }},
455\t\t\t}},
456\t\t}},""")
457 prev = f"Sw3D_{f}"
458
459 nodes.append(make_saver(prev, "cam3d"))
460 comp_path = local_root() / "comps" / "probe_cam3d.comp"
461 comp_path.write_text(make_comp("\n".join(nodes + splines), len(cases) - 1, w=640, h=360))
462 return comp_path, "cam3d", cases
463
464
465def build_probe_mask():
466 """Tests EllipseMask & RectangleMask aspect, SoftEdge, CornerRadius, Angle, PaintModes on 16:9 640x360."""
467 cases = [
468 (0, "ellipse_0.5x0.5_circle"),
469 (1, "ellipse_0.5x0.3_rot35"),
470 (2, "ellipse_soft0.1_fastgauss"),
471 (3, "ellipse_soft0.2_gauss"),
472 (4, "rect_0.5x0.5_16x9"),
473 (5, "rect_0.5x0.5_corner0.3"),
474 (6, "rect_0.6x0.4_rot30_soft0.05"),
475 (7, "chain_ellipse_sub_rect"),
476 (8, "chain_ellipse_mul_rect"),
477 (9, "chain_ellipse_inv_rect"),
478 ]
479 nodes = ["""\t\tWhiteBG = Background {
480\t\t\tInputs = {
481\t\t\t\tWidth = Input { Value = 640, },
482\t\t\t\tHeight = Input { Value = 360, },
483\t\t\t\tTopLeftRed = Input { Value = 1, },
484\t\t\t\tTopLeftGreen = Input { Value = 1, },
485\t\t\t\tTopLeftBlue = Input { Value = 1, },
486\t\t\t\tTopLeftAlpha = Input { Value = 1, },
487\t\t\t},
488\t\t},
489\t\tBlackBG = Background {
490\t\t\tInputs = {
491\t\t\t\tWidth = Input { Value = 640, },
492\t\t\t\tHeight = Input { Value = 360, },
493\t\t\t\tTopLeftAlpha = Input { Value = 1, },
494\t\t\t},
495\t\t},"""]
496 splines = []
497 prev = "BlackBG"
498 for f, label in cases:
499 if f == 0:
500 mblk = f"""\t\tMask_{f} = EllipseMask {{ Inputs = {{ MaskWidth = Input {{ Value = 640, }}, MaskHeight = Input {{ Value = 360, }}, Width = Input {{ Value = 0.5, }}, Height = Input {{ Value = 0.5, }}, }}, }},"""
501 elif f == 1:
502 mblk = f"""\t\tMask_{f} = EllipseMask {{ Inputs = {{ MaskWidth = Input {{ Value = 640, }}, MaskHeight = Input {{ Value = 360, }}, Width = Input {{ Value = 0.5, }}, Height = Input {{ Value = 0.3, }}, Angle = Input {{ Value = 35.0, }}, }}, }},"""
503 elif f == 2:
504 mblk = f"""\t\tMask_{f} = EllipseMask {{ Inputs = {{ MaskWidth = Input {{ Value = 640, }}, MaskHeight = Input {{ Value = 360, }}, Width = Input {{ Value = 0.4, }}, Height = Input {{ Value = 0.4, }}, SoftEdge = Input {{ Value = 0.1, }}, Filter = Input {{ Value = FuID {{ "Fast Gaussian" }}, }}, }}, }},"""
505 elif f == 3:
506 mblk = f"""\t\tMask_{f} = EllipseMask {{ Inputs = {{ MaskWidth = Input {{ Value = 640, }}, MaskHeight = Input {{ Value = 360, }}, Width = Input {{ Value = 0.4, }}, Height = Input {{ Value = 0.4, }}, SoftEdge = Input {{ Value = 0.2, }}, Filter = Input {{ Value = FuID {{ "Gaussian" }}, }}, }}, }},"""
507 elif f == 4:
508 mblk = f"""\t\tMask_{f} = RectangleMask {{ Inputs = {{ MaskWidth = Input {{ Value = 640, }}, MaskHeight = Input {{ Value = 360, }}, Width = Input {{ Value = 0.5, }}, Height = Input {{ Value = 0.5, }}, }}, }},"""
509 elif f == 5:
510 mblk = f"""\t\tMask_{f} = RectangleMask {{ Inputs = {{ MaskWidth = Input {{ Value = 640, }}, MaskHeight = Input {{ Value = 360, }}, Width = Input {{ Value = 0.5, }}, Height = Input {{ Value = 0.5, }}, CornerRadius = Input {{ Value = 0.3, }}, }}, }},"""
511 elif f == 6:
512 mblk = f"""\t\tMask_{f} = RectangleMask {{ Inputs = {{ MaskWidth = Input {{ Value = 640, }}, MaskHeight = Input {{ Value = 360, }}, Width = Input {{ Value = 0.6, }}, Height = Input {{ Value = 0.4, }}, Angle = Input {{ Value = 30.0, }}, SoftEdge = Input {{ Value = 0.05, }}, }}, }},"""
513 else:
514 pm = {7: "Subtract", 8: "Multiply", 9: "Invert"}[f]
515 mblk = f"""\t\tBaseM_{f} = EllipseMask {{ Inputs = {{ MaskWidth = Input {{ Value = 640, }}, MaskHeight = Input {{ Value = 360, }}, Width = Input {{ Value = 0.5, }}, Height = Input {{ Value = 0.5, }}, }}, }},
516\t\tMask_{f} = RectangleMask {{ Inputs = {{ EffectMask = Input {{ SourceOp = "BaseM_{f}", Source = "Mask", }}, PaintMode = Input {{ Value = FuID {{ "{pm}" }}, }}, MaskWidth = Input {{ Value = 640, }}, MaskHeight = Input {{ Value = 360, }}, Center = Input {{ Value = {{ 0.6, 0.55 }}, }}, Width = Input {{ Value = 0.35, }}, Height = Input {{ Value = 0.45, }}, }}, }},"""
517 nodes.append(mblk)
518 bl = {c[0]: (1.0 if c[0] == f else 0.0) for c in cases}
519 sname = f"SwM_{f}_Blend"
520 splines.append(step_spline(sname, bl))
521 nodes.append(f"""\t\tSwM_{f} = Merge {{
522\t\t\tInputs = {{
523\t\t\t\tEffectMask = Input {{ SourceOp = "Mask_{f}", Source = "Mask", }},
524\t\t\t\tBlend = Input {{ SourceOp = "{sname}", Source = "Value", }},
525\t\t\t\tBackground = Input {{ SourceOp = "{prev}", Source = "Output", }},
526\t\t\t\tForeground = Input {{ SourceOp = "WhiteBG", Source = "Output", }},
527\t\t\t\tPerformDepthMerge = Input {{ Value = 0, }},
528\t\t\t}},
529\t\t}},""")
530 prev = f"SwM_{f}"
531
532 nodes.append(make_saver(prev, "mask"))
533 comp_path = local_root() / "comps" / "probe_mask.comp"
534 comp_path.write_text(make_comp("\n".join(nodes + splines), len(cases) - 1, w=640, h=360))
535 return comp_path, "mask", cases
536
537
538def run_probe(comp_path: Path, prefix: str, cases: list, render_gt: bool = True):
539 end_f = max(f for f, _ in cases)
540 if render_gt:
541 if use_smb():
542 target_comp = str(comp_path)
543 else:
544 remote_comp = f"{REMOTE_ROOT}/comps/{comp_path.name}"
545 subprocess.run(["sg", "upload", str(comp_path), remote_comp], check=True)
546 target_comp = remote_comp
547 print(f"=== sg render {comp_path.name} (0..{end_f}) ===")
548 subprocess.run(["sg", "render", target_comp, "--start", "0", "--end", str(end_f)], check=True)
549 if not use_smb():
550 # Download rendered GT frames in one tar stream!
551 gt_dir = local_root() / "gt"
552 files = " ".join(f"{prefix}_{f:04d}.png" for f, _ in cases)
553 subprocess.run(
554 f'ssh root@10.0.0.1 "tar -C {REMOTE_ROOT}/gt -cf - {files}" | tar -C "{gt_dir}" -xf -',
555 shell=True, check=True,
556 )
557
558 # Also write a local-paths copy of the comp for render-check if SMB isn't mounted
559 eval_comp = comp_path
560 if not use_smb():
561 txt = comp_path.read_text().replace(CONTAINER_ROOT, str(local_root()))
562 eval_comp = comp_path.with_suffix(".local.comp")
563 eval_comp.write_text(txt)
564
565 print(f"\n=== Comparing {comp_path.name} ===")
566 for f, label in cases:
567 gt_p = local_root() / "gt" / f"{prefix}_{f:04d}.png"
568 out_p = local_root() / "ours" / f"{prefix}_{f:04d}.png"
569 res = subprocess.run(
570 [str(RENDER_CHECK), str(eval_comp), str(f), "--out", str(out_p), "--ref", str(gt_p)],
571 capture_output=True, text=True, check=True,
572 )
573 out_all = res.stdout + "\n" + res.stderr
574 diff_line = [ln for ln in out_all.splitlines() if ln.startswith("Diff vs")]
575 summary = diff_line[-1].split(": ", 1)[-1] if diff_line else out_all.strip()
576 print(f" f{f:02d} {label:<30s} | {summary}")
577
578
579def build_probe_cam3d_fov():
580 """Pinpoints exact Camera3D FilmGate/ResolutionGateFit/AoV/FLength + 60_moon_guide_u f5500 cylinder + all RotOrders IN-FRAME!"""
581 grid = generate_grid_chart()
582 cases = [
583 (0, "cam_default_no_aov"),
584 (1, "exportCam_Inside_37.85"),
585 (2, "exportCam_Width_37.85"),
586 (3, "exportCam_Height_37.85"),
587 (4, "exportCam_Outside_37.85"),
588 (5, "exportCam_AoVType_Horiz"),
589 (6, "exportCam_FLength_24mm"),
590 (7, "moon5500_exact_XZY"),
591 (8, "moon5500_exact_XYZ"),
592 (9, "moon5500_exact_YXZ"),
593 (10, "inframe_cam_XZY_15_20_10"),
594 (11, "inframe_cam_YXZ_15_20_10"),
595 ]
596 nodes = [make_loader("GridLoader", grid, post_mult=1), """\t\tBlackBG = Background {
597\t\t\tInputs = {
598\t\t\t\tWidth = Input { Value = 640, },
599\t\t\t\tHeight = Input { Value = 360, },
600\t\t\t\tTopLeftAlpha = Input { Value = 1, },
601\t\t\t},
602\t\t},"""]
603 splines = []
604 prev = "BlackBG"
605 for f, label in cases:
606 if f in (0, 1, 2, 3, 4, 5, 6):
607 extra_cam = {
608 0: "",
609 1: '\t\t\t\tAoV = Input { Value = 37.8493078162983, },\n\t\t\t\tFilmBack = Input { Value = 1, },\n\t\t\t\tFilmGate = Input { Value = FuID { "User" }, },\n\t\t\t\tApertureW = Input { Value = 1.4173236, },\n\t\t\t\tApertureH = Input { Value = 0.9448824, },',
610 2: '\t\t\t\tAoV = Input { Value = 37.8493078162983, },\n\t\t\t\tFilmBack = Input { Value = 1, },\n\t\t\t\tFilmGate = Input { Value = FuID { "User" }, },\n\t\t\t\tApertureW = Input { Value = 1.4173236, },\n\t\t\t\tApertureH = Input { Value = 0.9448824, },\n\t\t\t\tResolutionGateFit = Input { Value = FuID { "Width" }, },',
611 3: '\t\t\t\tAoV = Input { Value = 37.8493078162983, },\n\t\t\t\tFilmBack = Input { Value = 1, },\n\t\t\t\tFilmGate = Input { Value = FuID { "User" }, },\n\t\t\t\tApertureW = Input { Value = 1.4173236, },\n\t\t\t\tApertureH = Input { Value = 0.9448824, },\n\t\t\t\tResolutionGateFit = Input { Value = FuID { "Height" }, },',
612 4: '\t\t\t\tAoV = Input { Value = 37.8493078162983, },\n\t\t\t\tFilmBack = Input { Value = 1, },\n\t\t\t\tFilmGate = Input { Value = FuID { "User" }, },\n\t\t\t\tApertureW = Input { Value = 1.4173236, },\n\t\t\t\tApertureH = Input { Value = 0.9448824, },\n\t\t\t\tResolutionGateFit = Input { Value = FuID { "Outside" }, },',
613 5: '\t\t\t\tAoV = Input { Value = 37.8493078162983, },\n\t\t\t\tAoVType = Input { Value = FuID { "Horizontal" }, },\n\t\t\t\tFilmBack = Input { Value = 1, },\n\t\t\t\tFilmGate = Input { Value = FuID { "User" }, },\n\t\t\t\tApertureW = Input { Value = 1.4173236, },\n\t\t\t\tApertureH = Input { Value = 0.9448824, },',
614 6: '\t\t\t\tFLength = Input { Value = 24.0, },\n\t\t\t\tFilmBack = Input { Value = 1, },\n\t\t\t\tFilmGate = Input { Value = FuID { "User" }, },\n\t\t\t\tApertureW = Input { Value = 1.4173236, },\n\t\t\t\tApertureH = Input { Value = 0.9448824, },',
615 }[f]
616 nodes.append(f"""\t\tObj_{f} = ImagePlane3D {{
617\t\t\tInputs = {{
618\t\t\t\t["Transform3DOp.Scale.X"] = Input {{ Value = 2.0, }},
619\t\t\t\tMaterialInput = Input {{ SourceOp = "GridLoader", Source = "Output", }},
620\t\t\t}},
621\t\t}},
622\t\tCam_{f} = Camera3D {{
623\t\t\tInputs = {{
624\t\t\t\t["Transform3DOp.Translate.Z"] = Input {{ Value = 4.0, }},
625{extra_cam}
626\t\t\t}},
627\t\t}},""")
628 elif f in (7, 8, 9):
629 ro = {7: "XZY", 8: "XYZ", 9: "YXZ"}[f]
630 nodes.append(f"""\t\tObj_{f} = Shape3D {{
631\t\t\tInputs = {{
632\t\t\t\t["Transform3DOp.Translate.Y"] = Input {{ Value = 62.087, }},
633\t\t\t\t["Transform3DOp.Translate.Z"] = Input {{ Value = -44.83, }},
634\t\t\t\t["Transform3DOp.Rotate.Y"] = Input {{ Value = 362.6, }},
635\t\t\t\tShape = Input {{ Value = FuID {{ "SurfaceCylinderInputs" }}, }},
636\t\t\t\t["SurfaceCylinderInputs.Radius"] = Input {{ Value = 200, }},
637\t\t\t\t["SurfaceCylinderInputs.Height"] = Input {{ Value = 200, }},
638\t\t\t\t["SurfaceCylinderInputs.StartSweep"] = Input {{ Value = 196, }},
639\t\t\t\tMaterialInput = Input {{ SourceOp = "GridLoader", Source = "Output", }},
640\t\t\t}},
641\t\t}},
642\t\tCam_{f} = Camera3D {{
643\t\t\tInputs = {{
644\t\t\t\t["Transform3DOp.Rotate.RotOrder"] = Input {{ Value = FuID {{ "{ro}" }}, }},
645\t\t\t\t["Transform3DOp.Rotate.X"] = Input {{ Value = 11.152, }},
646\t\t\t\t["Transform3DOp.Rotate.Y"] = Input {{ Value = -16.972, }},
647\t\t\t\t["Transform3DOp.Rotate.Z"] = Input {{ Value = 0.0004, }},
648\t\t\t\tAoV = Input {{ Value = 37.8493078162983, }},
649\t\t\t\tFilmBack = Input {{ Value = 1, }},
650\t\t\t\tFilmGate = Input {{ Value = FuID {{ "User" }}, }},
651\t\t\t\tApertureW = Input {{ Value = 1.4173236, }},
652\t\t\t\tApertureH = Input {{ Value = 0.9448824, }},
653\t\t\t}},
654\t\t}},""")
655 else:
656 ro = "XZY" if f == 10 else "YXZ"
657 nodes.append(f"""\t\tObj_{f} = ImagePlane3D {{
658\t\t\tInputs = {{
659\t\t\t\t["Transform3DOp.Translate.X"] = Input {{ Value = -1.2, }},
660\t\t\t\t["Transform3DOp.Translate.Y"] = Input {{ Value = 0.9, }},
661\t\t\t\t["Transform3DOp.Translate.Z"] = Input {{ Value = -3.5, }},
662\t\t\t\t["Transform3DOp.Scale.X"] = Input {{ Value = 2.0, }},
663\t\t\t\tMaterialInput = Input {{ SourceOp = "GridLoader", Source = "Output", }},
664\t\t\t}},
665\t\t}},
666\t\tCam_{f} = Camera3D {{
667\t\t\tInputs = {{
668\t\t\t\t["Transform3DOp.Rotate.RotOrder"] = Input {{ Value = FuID {{ "{ro}" }}, }},
669\t\t\t\t["Transform3DOp.Rotate.X"] = Input {{ Value = 15.0, }},
670\t\t\t\t["Transform3DOp.Rotate.Y"] = Input {{ Value = 20.0, }},
671\t\t\t\t["Transform3DOp.Rotate.Z"] = Input {{ Value = 10.0, }},
672\t\t\t\tAoV = Input {{ Value = 37.8493078162983, }},
673\t\t\t\tFilmBack = Input {{ Value = 1, }},
674\t\t\t\tFilmGate = Input {{ Value = FuID {{ "User" }}, }},
675\t\t\t\tApertureW = Input {{ Value = 1.4173236, }},
676\t\t\t\tApertureH = Input {{ Value = 0.9448824, }},
677\t\t\t}},
678\t\t}},""")
679 nodes.append(f"""\t\tM3D_{f} = Merge3D {{
680\t\t\tInputs = {{
681\t\t\t\tSceneInput1 = Input {{ SourceOp = "Obj_{f}", Source = "Output", }},
682\t\t\t\tSceneInput2 = Input {{ SourceOp = "Cam_{f}", Source = "Output", }},
683\t\t\t}},
684\t\t}},
685\t\tRen_{f} = Renderer3D {{
686\t\t\tInputs = {{
687\t\t\t\tWidth = Input {{ Value = 640, }},
688\t\t\t\tHeight = Input {{ Value = 360, }},
689\t\t\t\tSceneInput = Input {{ SourceOp = "M3D_{f}", Source = "Output", }},
690\t\t\t}},
691\t\t}},""")
692 bl = {c[0]: (1.0 if c[0] == f else 0.0) for c in cases}
693 sname = f"SwF_{f}_Blend"
694 splines.append(step_spline(sname, bl))
695 nodes.append(f"""\t\tSwF_{f} = Merge {{
696\t\t\tInputs = {{
697\t\t\t\tBlend = Input {{ SourceOp = "{sname}", Source = "Value", }},
698\t\t\t\tBackground = Input {{ SourceOp = "{prev}", Source = "Output", }},
699\t\t\t\tForeground = Input {{ SourceOp = "Ren_{f}", Source = "Output", }},
700\t\t\t\tPerformDepthMerge = Input {{ Value = 0, }},
701\t\t\t}},
702\t\t}},""")
703 prev = f"SwF_{f}"
704 nodes.append(make_saver(prev, "cam3d_fov"))
705 comp_path = local_root() / "comps" / "probe_cam3d_fov.comp"
706 comp_path.write_text(make_comp("\n".join(nodes + splines), len(cases) - 1, w=640, h=360))
707 return comp_path, "cam3d_fov", cases
708
709
710def build_probe_transform():
711 """Tests Transform FilterMethod (Nearest/Box/Linear/Catmull), Edges (Canvas/Wrap/Dup/Mirror), Pivot+Angle+Aspect+Flip."""
712 grid = generate_grid_chart()
713 cases = [
714 (0, "xf_nearest_zoom4x", 'Size = Input { Value = 4.0, }, FilterMethod = Input { Value = 0, },'),
715 (1, "xf_linear_zoom4x", 'Size = Input { Value = 4.0, }, FilterMethod = Input { Value = 2, },'),
716 (2, "xf_edges_canvas", 'Center = Input { Value = { 0.8, 0.7 }, }, Size = Input { Value = 0.6, }, Edges = Input { Value = 0, },'),
717 (3, "xf_edges_wrap", 'Center = Input { Value = { 0.8, 0.7 }, }, Size = Input { Value = 0.6, }, Edges = Input { Value = 1, },'),
718 (4, "xf_edges_duplicate", 'Center = Input { Value = { 0.8, 0.7 }, }, Size = Input { Value = 0.6, }, Edges = Input { Value = 2, },'),
719 (5, "xf_edges_mirror", 'Center = Input { Value = { 0.8, 0.7 }, }, Size = Input { Value = 0.6, }, Edges = Input { Value = 3, },'),
720 (6, "xf_pivot_angle37", 'Pivot = Input { Value = { 0.25, 0.75 }, }, Angle = Input { Value = 37.0, }, Size = Input { Value = 0.85, },'),
721 (7, "xf_nonuniform_xy", 'UseSizeAndAspect = Input { Value = 0, }, XSize = Input { Value = 1.35, }, YSize = Input { Value = 0.65, }, Angle = Input { Value = 20.0, },'),
722 (8, "xf_aspect_1.6", 'Size = Input { Value = 0.8, }, Aspect = Input { Value = 1.6, }, Angle = Input { Value = -25.0, },'),
723 (9, "xf_flip_hv", 'FlipHoriz = Input { Value = 1, }, FlipVert = Input { Value = 1, }, Size = Input { Value = 0.8, },'),
724 (10, "xf_center_offset_rot", 'Center = Input { Value = { 0.35, 0.65 }, }, Pivot = Input { Value = { 0.7, 0.3 }, }, Angle = Input { Value = -42.0, }, Size = Input { Value = 0.75, },'),
725 (11, "xf_nearest_rot15_zoom3", 'Size = Input { Value = 3.0, }, Angle = Input { Value = 15.0, }, FilterMethod = Input { Value = 0, },'),
726 ]
727 nodes = [make_loader("GridLoader", grid, post_mult=1)]
728 splines = []
729 prev = "GridLoader"
730 for f, label, extra in cases:
731 bl = {c[0]: (1.0 if c[0] == f else 0.0) for c in cases}
732 sname = f"Xf_{f}_Blend"
733 splines.append(step_spline(sname, bl))
734 nodes.append(f"""\t\tXf_{f} = Transform {{
735\t\t\tInputs = {{
736\t\t\t\tBlend = Input {{ SourceOp = "{sname}", Source = "Value", }},
737\t\t\t\tInput = Input {{ SourceOp = "{prev}", Source = "Output", }},
738\t\t\t\t{extra}
739\t\t\t}},
740\t\t}},""")
741 prev = f"Xf_{f}"
742 nodes.append(make_saver(prev, "xf"))
743 comp_path = local_root() / "comps" / "probe_xf.comp"
744 comp_path.write_text(make_comp("\n".join(nodes + splines), len(cases) - 1))
745 return comp_path, "xf", [(c[0], c[1]) for c in cases]
746
747
748def build_probe_blur():
749 """Tests Blur (FastGauss/Gauss/Box + ClippingMode), DirectionalBlur (Linear/Centered/Radial/Zoom+Glow), ErodeDilate (+/-/Box/Circle)."""
750 grid = generate_grid_chart()
751 cases = [
752 (0, "blur_fgauss_5", "Blur", 'Filter = Input { Value = FuID { "Fast Gaussian" }, }, XBlurSize = Input { Value = 5.0, },'),
753 (1, "blur_fgauss_20", "Blur", 'Filter = Input { Value = FuID { "Fast Gaussian" }, }, XBlurSize = Input { Value = 20.0, },'),
754 (2, "blur_gauss_10", "Blur", 'Filter = Input { Value = FuID { "Gaussian" }, }, XBlurSize = Input { Value = 10.0, },'),
755 (3, "blur_box_10", "Blur", 'Filter = Input { Value = FuID { "Box" }, }, XBlurSize = Input { Value = 10.0, },'),
756 (4, "blur_clip_none_15", "Blur", 'Filter = Input { Value = FuID { "Fast Gaussian" }, }, XBlurSize = Input { Value = 15.0, }, ClippingMode = Input { Value = FuID { "None" }, },'),
757 (5, "dirblur_linear_0.08", "DirectionalBlur", 'Type = Input { Value = 0, }, Length = Input { Value = 0.08, }, Angle = Input { Value = 30.0, },'),
758 (6, "dirblur_radial_0.08", "DirectionalBlur", 'Type = Input { Value = 1, }, Length = Input { Value = 0.08, }, Angle = Input { Value = 30.0, },'),
759 (7, "dirblur_centered_0.08", "DirectionalBlur", 'Type = Input { Value = 2, }, Length = Input { Value = 0.08, }, Center = Input { Value = { 0.4, 0.6 }, },'),
760 (8, "dirblur_zoom_0.1_glow", "DirectionalBlur", 'Type = Input { Value = 3, }, Length = Input { Value = 0.10, }, Glow = Input { Value = 0.15, }, Center = Input { Value = { 0.6, 0.4 }, },'),
761 (9, "erode_box_+0.02", "ErodeDilate", 'XAmount = Input { Value = 0.02, },'),
762 (10, "erode_box_-0.02", "ErodeDilate", 'XAmount = Input { Value = -0.02, },'),
763 (11, "erode_circle_+0.02", "ErodeDilate", 'Filter = Input { Value = 3, }, XAmount = Input { Value = 0.02, },'),
764 ]
765 nodes = [make_loader("GridLoader", grid, post_mult=1)]
766 splines = []
767 prev = "GridLoader"
768 for f, label, kind, extra in cases:
769 bl = {c[0]: (1.0 if c[0] == f else 0.0) for c in cases}
770 sname = f"Bl_{f}_Blend"
771 splines.append(step_spline(sname, bl))
772 nodes.append(f"""\t\tOp_{f} = {kind} {{
773\t\t\tInputs = {{
774\t\t\t\tBlend = Input {{ SourceOp = "{sname}", Source = "Value", }},
775\t\t\t\tInput = Input {{ SourceOp = "{prev}", Source = "Output", }},
776\t\t\t\t{extra}
777\t\t\t}},
778\t\t}},""")
779 prev = f"Op_{f}"
780 nodes.append(make_saver(prev, "blur"))
781 comp_path = local_root() / "comps" / "probe_blur.comp"
782 comp_path.write_text(make_comp("\n".join(nodes + splines), len(cases) - 1))
783 return comp_path, "blur", [(c[0], c[1]) for c in cases]
784
785
786def build_probe_color_ops():
787 """Tests BrightnessContrast, ColorGain, and ChannelBoolean edge cases."""
788 chart = generate_color_chart()
789 grid = generate_grid_chart()
790 cases = [
791 (0, "bc_gain1.4_lift0.1", "BrightnessContrast", 'Gain = Input { Value = 1.4, }, Lift = Input { Value = 0.1, },'),
792 (1, "bc_gamma0.6_con0.4", "BrightnessContrast", 'Gamma = Input { Value = 0.6, }, Contrast = Input { Value = 0.4, }, Brightness = Input { Value = 0.05, },'),
793 (2, "bc_low0.2_high0.8", "BrightnessContrast", 'Low = Input { Value = 0.2, }, High = Input { Value = 0.8, },'),
794 (3, "bc_sat0.3_prediv1", "BrightnessContrast", 'Saturation = Input { Value = 0.3, }, Brightness = Input { Value = 0.15, }, PreDividePostMultiply = Input { Value = 1, },'),
795 (4, "cg_midhigh_hue0.58", "ColorGain", 'MidHue = Input { Value = 0.583, }, HighHue = Input { Value = 0.583, },'),
796 (5, "cg_dark0.2_mid0.6_hi0.9", "ColorGain", 'DarkHue = Input { Value = 0.2, }, MidHue = Input { Value = 0.6, }, HighHue = Input { Value = 0.9, },'),
797 (6, "cg_gain_lift_gamma_rgb", "ColorGain", 'GainRed = Input { Value = 1.3, }, LiftGreen = Input { Value = 0.15, }, GammaBlue = Input { Value = 0.7, },'),
798 (7, "cg_sat_bands", "ColorGain", 'SaturationLow = Input { Value = 0.3, }, SaturationMid = Input { Value = 1.6, }, SaturationHigh = Input { Value = 0.5, },'),
799 (8, "cb_copy_swizzle_gbr", "ChannelBoolean", 'Operation = Input { Value = 0, }, ToRed = Input { Value = 1, }, ToGreen = Input { Value = 2, }, ToBlue = Input { Value = 0, },'),
800 (9, "cb_add_fg", "ChannelBoolean", 'Operation = Input { Value = 1, }, Foreground = Input { SourceOp = "GridLoader", Source = "Output", },'),
801 (10, "cb_mul_fg", "ChannelBoolean", 'Operation = Input { Value = 6, }, Foreground = Input { SourceOp = "GridLoader", Source = "Output", },'),
802 (11, "cb_diff_fg", "ChannelBoolean", 'Operation = Input { Value = 8, }, Foreground = Input { SourceOp = "GridLoader", Source = "Output", },'),
803 ]
804 nodes = [
805 make_loader("ChartLoader", chart, post_mult=1),
806 make_loader("GridLoader", grid, post_mult=1),
807 ]
808 splines = []
809 prev = "ChartLoader"
810 for f, label, kind, extra in cases:
811 bl = {c[0]: (1.0 if c[0] == f else 0.0) for c in cases}
812 sname = f"Co_{f}_Blend"
813 splines.append(step_spline(sname, bl))
814 in_port = "Background" if kind == "ChannelBoolean" else "Input"
815 nodes.append(f"""\t\tCo_{f} = {kind} {{
816\t\t\tInputs = {{
817\t\t\t\tBlend = Input {{ SourceOp = "{sname}", Source = "Value", }},
818\t\t\t\t{in_port} = Input {{ SourceOp = "{prev}", Source = "Output", }},
819\t\t\t\t{extra}
820\t\t\t}},
821\t\t}},""")
822 prev = f"Co_{f}"
823 nodes.append(make_saver(prev, "color_ops"))
824 comp_path = local_root() / "comps" / "probe_color_ops.comp"
825 comp_path.write_text(make_comp("\n".join(nodes + splines), len(cases) - 1))
826 return comp_path, "color_ops", [(c[0], c[1]) for c in cases]
827
828
829def build_probe_displace():
830 """Tests Displace XY (sign, offsets, channels) + Radial/Bump (strength, spread, light)."""
831 grid = generate_grid_chart()
832 chart = generate_color_chart()
833 cases = [
834 (0, "disp_xy_default_off", 'Type = Input { Value = 1, }, XRefraction = Input { Value = 0.08, }, YRefraction = Input { Value = 0.04, },'),
835 (1, "disp_xy_off-0.5_ch_rg", 'Type = Input { Value = 1, }, XChannel = Input { Value = 0, }, YChannel = Input { Value = 1, }, XOffset = Input { Value = -0.5, }, YOffset = Input { Value = -0.5, }, XRefraction = Input { Value = 0.08, }, YRefraction = Input { Value = 0.08, },'),
836 (2, "disp_xy_ch_g_only", 'Type = Input { Value = 1, }, XChannel = Input { Value = 1, }, XOffset = Input { Value = -0.5, }, XRefraction = Input { Value = 0.12, },'),
837 (3, "disp_xy_neg_refract", 'Type = Input { Value = 1, }, XChannel = Input { Value = 0, }, XOffset = Input { Value = -0.5, }, XRefraction = Input { Value = -0.10, },'),
838 (4, "disp_radial_0.15", 'Type = Input { Value = 0, }, RefractionStrength = Input { Value = 0.15, },'),
839 (5, "disp_radial_spread0.4", 'Type = Input { Value = 0, }, RefractionStrength = Input { Value = 0.15, }, Spread = Input { Value = 0.4, },'),
840 (6, "disp_radial_light0.5", 'Type = Input { Value = 0, }, RefractionStrength = Input { Value = 0.15, }, LightPower = Input { Value = 0.5, },'),
841 ]
842 nodes = [
843 make_loader("GridLoader", grid, post_mult=1),
844 make_loader("ChartLoader", chart, post_mult=1),
845 ]
846 splines = []
847 prev = "GridLoader"
848 for f, label, extra in cases:
849 bl = {c[0]: (1.0 if c[0] == f else 0.0) for c in cases}
850 sname = f"Dp_{f}_Blend"
851 splines.append(step_spline(sname, bl))
852 nodes.append(f"""\t\tDp_{f} = Displace {{
853\t\t\tInputs = {{
854\t\t\t\tBlend = Input {{ SourceOp = "{sname}", Source = "Value", }},
855\t\t\t\tInput = Input {{ SourceOp = "{prev}", Source = "Output", }},
856\t\t\t\tForeground = Input {{ SourceOp = "ChartLoader", Source = "Output", }},
857\t\t\t\t{extra}
858\t\t\t}},
859\t\t}},""")
860 prev = f"Dp_{f}"
861 nodes.append(make_saver(prev, "displace"))
862 comp_path = local_root() / "comps" / "probe_displace.comp"
863 comp_path.write_text(make_comp("\n".join(nodes + splines), len(cases) - 1))
864 return comp_path, "displace", [(c[0], c[1]) for c in cases]
865
866
867def build_probe_glow():
868 """Tests SoftGlow and Glow edge cases (Gain, XGlowSize=0, Threshold, GlowOnly, GlowSize)."""
869 grid = generate_grid_chart()
870 cases = [
871 (0, "sg_default", "SoftGlow", ''),
872 (1, "sg_size0_gain1.38", "SoftGlow", 'XGlowSize = Input { Value = 0.0, }, Gain = Input { Value = 1.378, },'),
873 (2, "sg_size21_gain1.06", "SoftGlow", 'XGlowSize = Input { Value = 21.3, }, Gain = Input { Value = 1.063, },'),
874 (3, "sg_size6_gain2.0", "SoftGlow", 'XGlowSize = Input { Value = 6.3, }, Gain = Input { Value = 2.0, },'),
875 (4, "sg_thresh0.6_size12", "SoftGlow", 'Threshold = Input { Value = 0.6, }, XGlowSize = Input { Value = 12.0, }, Gain = Input { Value = 1.5, },'),
876 (5, "sg_glow_only", "SoftGlow", 'GlowOnly = Input { Value = 1, }, XGlowSize = Input { Value = 10.0, }, Gain = Input { Value = 1.2, },'),
877 (6, "glow_default", "Glow", ''),
878 (7, "glow_0.58_size12", "Glow", 'Glow = Input { Value = 0.583, }, GlowSize = Input { Value = 12.0, },'),
879 ]
880 nodes = [make_loader("GridLoader", grid, post_mult=1)]
881 splines = []
882 prev = "GridLoader"
883 for f, label, kind, extra in cases:
884 bl = {c[0]: (1.0 if c[0] == f else 0.0) for c in cases}
885 sname = f"Gl_{f}_Blend"
886 splines.append(step_spline(sname, bl))
887 nodes.append(f"""\t\tGl_{f} = {kind} {{
888\t\t\tInputs = {{
889\t\t\t\tBlend = Input {{ SourceOp = "{sname}", Source = "Value", }},
890\t\t\t\tInput = Input {{ SourceOp = "{prev}", Source = "Output", }},
891\t\t\t\t{extra}
892\t\t\t}},
893\t\t}},""")
894 prev = f"Gl_{f}"
895 nodes.append(make_saver(prev, "glow"))
896 comp_path = local_root() / "comps" / "probe_glow.comp"
897 comp_path.write_text(make_comp("\n".join(nodes + splines), len(cases) - 1))
898 return comp_path, "glow", [(c[0], c[1]) for c in cases]
899
900
901def build_probe_text():
902 """Tests TextPlus size, alignment, tracking, and outline shading (Liberation Sans)."""
903 cases = [
904 (0, "txt_center_0.12", 'StyledText = Input { Value = "Hello 123", }, Size = Input { Value = 0.12, },'),
905 (1, "txt_left_top", 'StyledText = Input { Value = "TopLeft", }, Size = Input { Value = 0.10, }, Center = Input { Value = { 0.2, 0.7 }, }, HorizontalLeftCenterRight = Input { Value = -1, }, VerticalTopCenterBottom = Input { Value = -1, },'),
906 (2, "txt_right_bottom", 'StyledText = Input { Value = "BotRight", }, Size = Input { Value = 0.10, }, Center = Input { Value = { 0.8, 0.3 }, }, HorizontalLeftCenterRight = Input { Value = 1, }, VerticalTopCenterBottom = Input { Value = 1, },'),
907 (3, "txt_tracking_1.3", 'StyledText = Input { Value = "WIDE", }, Size = Input { Value = 0.12, }, CharacterSpacing = Input { Value = 1.3, },'),
908 (4, "txt_border_default", 'StyledText = Input { Value = "the", }, Size = Input { Value = 0.18, }, Enabled2 = Input { Value = 1, }, ElementShape2 = Input { Value = 2, }, Thickness2 = Input { Value = 0.04, }, Red2 = Input { Value = 0.9, }, Green2 = Input { Value = 0.2, }, Blue2 = Input { Value = 0.2, },'),
909 (5, "txt_border_ext_rnd", 'StyledText = Input { Value = "Hi Box", }, Size = Input { Value = 0.14, }, Enabled2 = Input { Value = 1, }, ElementShape2 = Input { Value = 2, }, Level2 = Input { Value = 3, }, ExtendHorizontal2 = Input { Value = 0.2, }, ExtendVertical2 = Input { Value = 0.15, }, Round2 = Input { Value = 0.4, }, Red2 = Input { Value = 0.15, }, Green2 = Input { Value = 0.45, }, Blue2 = Input { Value = 0.85, },'),
910 (6, "txt_border_offset", 'StyledText = Input { Value = "BOX", }, Size = Input { Value = 0.16, }, Enabled2 = Input { Value = 1, }, ElementShape2 = Input { Value = 2, }, Level2 = Input { Value = 2, }, ExtendHorizontal2 = Input { Value = 0.1, }, ExtendVertical2 = Input { Value = 0.1, }, Offset2 = Input { Value = { 0.03, -0.02 }, }, Red2 = Input { Value = 0.2, }, Green2 = Input { Value = 0.7, }, Blue2 = Input { Value = 0.3, }, Alpha2 = Input { Value = 0.8, },'),
911 ]
912 nodes = ["""\t\tBlackBG = Background {
913\t\t\tInputs = { Width = Input { Value = 512, }, Height = Input { Value = 512, }, TopLeftAlpha = Input { Value = 1, }, },
914\t\t},"""]
915 splines = []
916 prev = "BlackBG"
917 for f, label, extra in cases:
918 bl = {c[0]: (1.0 if c[0] == f else 0.0) for c in cases}
919 sname = f"Tx_{f}_Blend"
920 splines.append(step_spline(sname, bl))
921 nodes.append(f"""\t\tTxt_{f} = TextPlus {{
922\t\t\tInputs = {{
923\t\t\t\tWidth = Input {{ Value = 512, }},
924\t\t\t\tHeight = Input {{ Value = 512, }},
925\t\t\t\tFont = Input {{ Value = "Liberation Sans", }},
926\t\t\t\tStyle = Input {{ Value = "Regular", }},
927\t\t\t\t{extra}
928\t\t\t}},
929\t\t}},
930\t\tM_{f} = Merge {{
931\t\t\tInputs = {{
932\t\t\t\tBlend = Input {{ SourceOp = "{sname}", Source = "Value", }},
933\t\t\t\tBackground = Input {{ SourceOp = "{prev}", Source = "Output", }},
934\t\t\t\tForeground = Input {{ SourceOp = "Txt_{f}", Source = "Output", }},
935\t\t\t}},
936\t\t}},""")
937 prev = f"M_{f}"
938 nodes.append(make_saver(prev, "text"))
939 comp_path = local_root() / "comps" / "probe_text.comp"
940 comp_path.write_text(make_comp("\n".join(nodes + splines), len(cases) - 1))
941 return comp_path, "text", [(c[0], c[1]) for c in cases]
942
943
944def build_probe_noise_text():
945 """Dissects Fusion 21.1 FastNoise exact lattice/seed/fBm AND TextPlus red-outline + ColorGain outer edge."""
946 cases = [
947 (0, "fn_d0_s4_z0", "FastNoise", 'Width = Input { Value = 512, }, Height = Input { Value = 512, }, Detail = Input { Value = 0, }, Contrast = Input { Value = 1, }, Brightness = Input { Value = 0, }, XScale = Input { Value = 4, }, Seethe = Input { Value = 0, }, Color1Alpha = Input { Value = 1, },'),
948 (1, "fn_d0_s8_z0", "FastNoise", 'Width = Input { Value = 512, }, Height = Input { Value = 512, }, Detail = Input { Value = 0, }, Contrast = Input { Value = 1, }, Brightness = Input { Value = 0, }, XScale = Input { Value = 8, }, Seethe = Input { Value = 0, }, Color1Alpha = Input { Value = 1, },'),
949 (2, "fn_d0_s4_z0.5", "FastNoise", 'Width = Input { Value = 512, }, Height = Input { Value = 512, }, Detail = Input { Value = 0, }, Contrast = Input { Value = 1, }, Brightness = Input { Value = 0, }, XScale = Input { Value = 4, }, Seethe = Input { Value = 0.5, }, Color1Alpha = Input { Value = 1, },'),
950 (3, "fn_d0_s4_z256", "FastNoise", 'Width = Input { Value = 512, }, Height = Input { Value = 512, }, Detail = Input { Value = 0, }, Contrast = Input { Value = 1, }, Brightness = Input { Value = 0, }, XScale = Input { Value = 4, }, Seethe = Input { Value = 256, }, Color1Alpha = Input { Value = 1, },'),
951 (4, "fn_d1_s4_z0", "FastNoise", 'Width = Input { Value = 512, }, Height = Input { Value = 512, }, Detail = Input { Value = 1, }, Contrast = Input { Value = 1, }, Brightness = Input { Value = 0, }, XScale = Input { Value = 4, }, Seethe = Input { Value = 0, }, Color1Alpha = Input { Value = 1, },'),
952 (5, "fn_d0_s4_discont", "FastNoise", 'Width = Input { Value = 512, }, Height = Input { Value = 512, }, Detail = Input { Value = 0, }, Contrast = Input { Value = 1, }, Brightness = Input { Value = 0, }, XScale = Input { Value = 4, }, Discontinuous = Input { Value = 1, }, Color1Alpha = Input { Value = 1, },'),
953 (6, "fn_d0_s4_ctr64.5", "FastNoise", 'Width = Input { Value = 512, }, Height = Input { Value = 512, }, Detail = Input { Value = 0, }, Contrast = Input { Value = 1, }, Brightness = Input { Value = 0, }, XScale = Input { Value = 4, }, Center = Input { Value = { 64.5, 0.5 }, }, Color1Alpha = Input { Value = 1, },'),
954 (7, "fn_d0_16x9_s4", "FastNoise", 'Width = Input { Value = 640, }, Height = Input { Value = 360, }, Detail = Input { Value = 0, }, Contrast = Input { Value = 1, }, Brightness = Input { Value = 0, }, XScale = Input { Value = 4, }, YScale = Input { Value = 10, }, Color1Alpha = Input { Value = 1, },'),
955 (8, "txt_red_outline", "TextCG", 'cg=0'),
956 (9, "txt_red_cg_blue", "TextCG", 'cg=1'),
957 (10, "txt_red_cg_prediv","TextCG", 'cg=2'),
958 ]
959 nodes = ["""\t\tDarkBG = Background {
960\t\t\tInputs = { Width = Input { Value = 512, }, Height = Input { Value = 512, }, TopLeftRed = Input { Value = 0.08, }, TopLeftGreen = Input { Value = 0.10, }, TopLeftBlue = Input { Value = 0.22, }, TopLeftAlpha = Input { Value = 1, }, },
961\t\t},
962\t\tTxtW = TextPlus {
963\t\t\tInputs = {
964\t\t\t\tWidth = Input { Value = 512, }, Height = Input { Value = 512, },
965\t\t\t\tFont = Input { Value = "Liberation Sans", }, Style = Input { Value = "Bold", },
966\t\t\t\tStyledText = Input { Value = "W", }, Size = Input { Value = 0.55, },
967\t\t\t\tRed1 = Input { Value = 0, }, Green1 = Input { Value = 0, }, Blue1 = Input { Value = 0, },
968\t\t\t\tEnabled2 = Input { Value = 1, }, ElementShape2 = Input { Value = 1, },
969\t\t\t\tThickness2 = Input { Value = 0.05, }, Round2 = Input { Value = 1, },
970\t\t\t\tRed2 = Input { Value = 1, }, Green2 = Input { Value = 0, }, Blue2 = Input { Value = 0, },
971\t\t\t},
972\t\t},
973\t\tCG_Blue = ColorGain {
974\t\t\tInputs = { MidHue = Input { Value = 0.62, }, HighHue = Input { Value = 0.62, }, Input = Input { SourceOp = "TxtW", Source = "Output", }, },
975\t\t},
976\t\tCG_Blue_PD = ColorGain {
977\t\t\tInputs = { MidHue = Input { Value = 0.62, }, HighHue = Input { Value = 0.62, }, PreDividePostMultiply = Input { Value = 1, }, Input = Input { SourceOp = "TxtW", Source = "Output", }, },
978\t\t},"""]
979 splines = []
980 prev = "DarkBG"
981 for f, label, kind, extra in cases:
982 bl = {c[0]: (1.0 if c[0] == f else 0.0) for c in cases}
983 sname = f"Nt_{f}_Blend"
984 splines.append(step_spline(sname, bl))
985 if kind == "FastNoise":
986 nodes.append(f"""\t\tFn_{f} = FastNoise {{
987\t\t\tInputs = {{ {extra} }},
988\t\t}},
989\t\tM_{f} = Merge {{
990\t\t\tInputs = {{
991\t\t\t\tBlend = Input {{ SourceOp = "{sname}", Source = "Value", }},
992\t\t\t\tBackground = Input {{ SourceOp = "{prev}", Source = "Output", }},
993\t\t\t\tForeground = Input {{ SourceOp = "Fn_{f}", Source = "Output", }},
994\t\t\t}},
995\t\t}},""")
996 else:
997 src_op = {"cg=0": "TxtW", "cg=1": "CG_Blue", "cg=2": "CG_Blue_PD"}[extra]
998 nodes.append(f"""\t\tM_{f} = Merge {{
999\t\t\tInputs = {{
1000\t\t\t\tBlend = Input {{ SourceOp = "{sname}", Source = "Value", }},
1001\t\t\t\tBackground = Input {{ SourceOp = "{prev}", Source = "Output", }},
1002\t\t\t\tForeground = Input {{ SourceOp = "{src_op}", Source = "Output", }},
1003\t\t\t}},
1004\t\t}},""")
1005 prev = f"M_{f}"
1006 nodes.append(make_saver(prev, "noise_text"))
1007 comp_path = local_root() / "comps" / "probe_noise_text.comp"
1008 comp_path.write_text(make_comp("\n".join(nodes + splines), len(cases) - 1))
1009 return comp_path, "noise_text", [(c[0], c[1]) for c in cases]
1010
1011
1012def build_probe_tier1_a():
1013 """Probes UltraKeyer, HueCurves, Filter (types 0..4), and Sharpen against Fusion 21.1."""
1014 grid = generate_grid_chart()
1015 chart = generate_color_chart()
1016 cases = [
1017 # UltraKeyer on grid_chart (green=(0.235,0.706,0.294), blue=(0.235,0.373,0.784), red=(0.745,0.235,0.235))
1018 (0, "uk_green_default", "UltraKeyer", "GridLoader", 'BackgroundRed = Input { Value = 0.235, }, BackgroundGreen = Input { Value = 0.706, }, BackgroundBlue = Input { Value = 0.294, },'),
1019 (1, "uk_green_nopremult", "UltraKeyer", "GridLoader", 'BackgroundRed = Input { Value = 0.235, }, BackgroundGreen = Input { Value = 0.706, }, BackgroundBlue = Input { Value = 0.294, }, PostMultiplyImage = Input { Value = 0, },'),
1020 (2, "uk_green_sep0.3_clip", "UltraKeyer", "GridLoader", 'BackgroundRed = Input { Value = 0.235, }, BackgroundGreen = Input { Value = 0.706, }, BackgroundBlue = Input { Value = 0.294, }, MatteSeparation = Input { Value = 0.3, }, LowMatteThreshold = Input { Value = 0.1, }, High = Input { Value = 0.8, },'),
1021 (3, "uk_blue_key", "UltraKeyer", "GridLoader", 'BackgroundRed = Input { Value = 0.235, }, BackgroundGreen = Input { Value = 0.373, }, BackgroundBlue = Input { Value = 0.784, },'),
1022 (4, "uk_chart_green_key", "UltraKeyer", "ChartLoader", 'BackgroundRed = Input { Value = 0.1, }, BackgroundGreen = Input { Value = 0.85, }, BackgroundBlue = Input { Value = 0.1, }, MatteSeparation = Input { Value = 0.5, },'),
1023 # HueCurves on color_chart (x in [0..6], neutral=1.0)
1024 (5, "hc_hue_red+0.3", "HueCurves", "ChartLoader", 'Hue = Input { SourceOp = "HC5_Hue", Source = "Value", },'),
1025 (6, "hc_sat_green0.2_cy1.8","HueCurves", "ChartLoader", 'Sat = Input { SourceOp = "HC6_Sat", Source = "Value", },'),
1026 (7, "hc_lum_blue0.5", "HueCurves", "ChartLoader", 'Lum = Input { SourceOp = "HC7_Lum", Source = "Value", },'),
1027 (8, "hc_red_suppress", "HueCurves", "ChartLoader", 'Red = Input { SourceOp = "HC8_Red", Source = "Value", }, GreenSuppress = Input { SourceOp = "HC8_GSup", Source = "Value", },'),
1028 # Filter (FilterType 0, 1, 2, 3, 4) on grid_chart
1029 (9, "flt_type0_relief", "Filter", "GridLoader", 'FilterType = Input { Value = 0, },'),
1030 (10, "flt_type1", "Filter", "GridLoader", 'FilterType = Input { Value = 1, },'),
1031 (11, "flt_type2", "Filter", "GridLoader", 'FilterType = Input { Value = 2, },'),
1032 (12, "flt_type3", "Filter", "GridLoader", 'FilterType = Input { Value = 3, },'),
1033 (13, "flt_type3_pow2", "Filter", "GridLoader", 'FilterType = Input { Value = 3, }, Power = Input { Value = 2.0, },'),
1034 # Sharpen on grid_chart
1035 (14, "sharp_amt1", "Sharpen", "GridLoader", 'XAmount = Input { Value = 1.0, },'),
1036 (15, "sharp_amt3", "Sharpen", "GridLoader", 'XAmount = Input { Value = 3.0, },'),
1037 (16, "sharp_amt2_sz3", "Sharpen", "GridLoader", 'XAmount = Input { Value = 2.0, }, XSize = Input { Value = 3.0, },'),
1038 ]
1039 def lut_bezier(name, pts):
1040 kfs = "\n".join(f"\t\t\t\t\t[{x}] = {{ {y} }}," for x, y in pts)
1041 return f"""\t\t{name} = LUTBezier {{
1042\t\t\tSmoothEndsTransition = true,
1043\t\t\tKeyColorSplines = {{
1044\t\t\t\t[0] = {{
1045{kfs}
1046\t\t\t\t}}
1047\t\t\t}},
1048\t\t}},"""
1049 nodes = [
1050 make_loader("GridLoader", grid, post_mult=1),
1051 make_loader("ChartLoader", chart, post_mult=1),
1052 """\t\tBlackBG = Background {
1053\t\t\tInputs = { Width = Input { Value = 512, }, Height = Input { Value = 512, }, TopLeftAlpha = Input { Value = 1, }, },
1054\t\t},""",
1055 lut_bezier("HC5_Hue", [(0, 1.3), (1, 1.0), (2, 1.0), (3, 1.0), (4, 1.0), (5, 1.0), (6, 1.3)]),
1056 lut_bezier("HC6_Sat", [(0, 1.0), (1, 1.0), (2, 0.2), (3, 1.8), (4, 1.0), (5, 1.0), (6, 1.0)]),
1057 lut_bezier("HC7_Lum", [(0, 1.0), (1, 1.0), (2, 1.0), (3, 1.0), (4, 0.5), (5, 1.0), (6, 1.0)]),
1058 lut_bezier("HC8_Red", [(0, 0.5), (1, 1.0), (2, 1.0), (3, 1.0), (4, 1.0), (5, 1.0), (6, 0.5)]),
1059 lut_bezier("HC8_GSup", [(0, 1.0), (1, 1.0), (2, 0.3), (3, 1.0), (4, 1.0), (5, 1.0), (6, 1.0)]),
1060 ]
1061 splines = []
1062 prev = "BlackBG"
1063 for f, label, kind, src_in, extra in cases:
1064 bl = {c[0]: (1.0 if c[0] == f else 0.0) for c in cases}
1065 sname = f"T1a_{f}_Blend"
1066 splines.append(step_spline(sname, bl))
1067 nodes.append(f"""\t\tOp_{f} = {kind} {{
1068\t\t\tInputs = {{
1069\t\t\t\tInput = Input {{ SourceOp = "{src_in}", Source = "Output", }},
1070\t\t\t\t{extra}
1071\t\t\t}},
1072\t\t}},
1073\t\tM_{f} = Merge {{
1074\t\t\tInputs = {{
1075\t\t\t\tBlend = Input {{ SourceOp = "{sname}", Source = "Value", }},
1076\t\t\t\tBackground = Input {{ SourceOp = "{prev}", Source = "Output", }},
1077\t\t\t\tForeground = Input {{ SourceOp = "Op_{f}", Source = "Output", }},
1078\t\t\t}},
1079\t\t}},""")
1080 prev = f"M_{f}"
1081 nodes.append(make_saver(prev, "tier1_a"))
1082 comp_path = local_root() / "comps" / "probe_tier1_a.comp"
1083 comp_path.write_text(make_comp("\n".join(nodes + splines), len(cases) - 1))
1084 return comp_path, "tier1_a", [(c[0], c[1]) for c in cases]
1085
1086
1087def build_probe_tier1_b():
1088 """Probes Shadow, Dissolve, CornerPositioner, and DVE against Fusion 21.1."""
1089 grid = generate_grid_chart()
1090 chart = generate_color_chart()
1091 cases = [
1092 (0, "sh_overlay_off_soft", "Shadow", "ShapeFG", 'ShadowOffset = Input { Value = { 0.55, 0.45 }, }, Softness = Input { Value = 0.02, }, Alpha = Input { Value = 0.7, },'),
1093 (1, "sh_colored_magenta", "Shadow", "ShapeFG", 'ShadowOffset = Input { Value = { 0.55, 0.45 }, }, Softness = Input { Value = 0.02, }, Red = Input { Value = 1.0, }, Green = Input { Value = 0.1, }, Blue = Input { Value = 0.8, }, Alpha = Input { Value = 0.8, },'),
1094 (2, "sh_shadow_only", "Shadow", "ShapeFG", 'ShadowOffset = Input { Value = { 0.55, 0.45 }, }, Softness = Input { Value = 0.02, }, Output = Input { Value = 1, }, Alpha = Input { Value = 0.8, },'),
1095 (3, "dissolve_0.35", "Dissolve", "GridLoader", 'Foreground = Input { SourceOp = "ChartLoader", Source = "Output", }, Mix = Input { Value = 0.35, },'),
1096 (4, "dissolve_0.75", "Dissolve", "GridLoader", 'Foreground = Input { SourceOp = "ChartLoader", Source = "Output", }, Mix = Input { Value = 0.75, },'),
1097 (5, "cp_perspective1", "CornerPositioner", "GridLoader", 'TopLeft = Input { Value = { 0.15, 0.85 }, }, TopRight = Input { Value = { 0.90, 0.95 }, }, BottomLeft = Input { Value = { 0.05, 0.10 }, }, BottomRight = Input { Value = { 0.85, 0.20 }, },'),
1098 (6, "cp_perspective2", "CornerPositioner", "GridLoader", 'TopLeft = Input { Value = { 0.2, 0.8 }, }, TopRight = Input { Value = { 0.8, 0.7 }, }, BottomLeft = Input { Value = { 0.1, 0.2 }, }, BottomRight = Input { Value = { 0.9, 0.1 }, },'),
1099 (7, "dve_xrot35", "DVE", "GridLoader", 'XRotation = Input { Value = 35, },'),
1100 (8, "dve_yrot40", "DVE", "GridLoader", 'YRotation = Input { Value = 40, },'),
1101 (9, "dve_zrot25_zmove1.5", "DVE", "GridLoader", 'ZRotation = Input { Value = 25, }, ZMove = Input { Value = 1.5, },'),
1102 (10, "dve_xyz_center", "DVE", "GridLoader", 'XRotation = Input { Value = 25, }, YRotation = Input { Value = -30, }, ZRotation = Input { Value = 15, }, Center = Input { Value = { 0.45, 0.55 }, },'),
1103 (11, "dve_yrot40_pivot", "DVE", "GridLoader", 'YRotation = Input { Value = 40, }, Pivot = Input { Value = { 0.2, 0.5 }, },'),
1104 ]
1105 nodes = [
1106 make_loader("GridLoader", grid, post_mult=1),
1107 make_loader("ChartLoader", chart, post_mult=1),
1108 """\t\tGrayBG = Background {
1109\t\t\tInputs = { Width = Input { Value = 512, }, Height = Input { Value = 512, }, TopLeftRed = Input { Value = 0.8, }, TopLeftGreen = Input { Value = 0.8, }, TopLeftBlue = Input { Value = 0.8, }, TopLeftAlpha = Input { Value = 1, }, },
1110\t\t},
1111\t\tEllMask = EllipseMask {
1112\t\t\tInputs = { MaskWidth = Input { Value = 512, }, MaskHeight = Input { Value = 512, }, Width = Input { Value = 0.4, }, Height = Input { Value = 0.4, }, },
1113\t\t},
1114\t\tShapeFG = Background {
1115\t\t\tInputs = { Width = Input { Value = 512, }, Height = Input { Value = 512, }, TopLeftRed = Input { Value = 0.2, }, TopLeftGreen = Input { Value = 0.5, }, TopLeftBlue = Input { Value = 0.9, }, TopLeftAlpha = Input { Value = 1, }, EffectMask = Input { SourceOp = "EllMask", Source = "Mask", }, },
1116\t\t},""",
1117 ]
1118 splines = []
1119 prev = "GrayBG"
1120 for f, label, kind, src_in, extra in cases:
1121 bl = {c[0]: (1.0 if c[0] == f else 0.0) for c in cases}
1122 sname = f"T1b_{f}_Blend"
1123 splines.append(step_spline(sname, bl))
1124 in_port = "Background" if kind == "Dissolve" else "Input"
1125 nodes.append(f"""\t\tOp_{f} = {kind} {{
1126\t\t\tInputs = {{
1127\t\t\t\t{in_port} = Input {{ SourceOp = "{src_in}", Source = "Output", }},
1128\t\t\t\t{extra}
1129\t\t\t}},
1130\t\t}},
1131\t\tM_{f} = Merge {{
1132\t\t\tInputs = {{
1133\t\t\t\tBlend = Input {{ SourceOp = "{sname}", Source = "Value", }},
1134\t\t\t\tBackground = Input {{ SourceOp = "{prev}", Source = "Output", }},
1135\t\t\t\tForeground = Input {{ SourceOp = "Op_{f}", Source = "Output", }},
1136\t\t\t}},
1137\t\t}},""")
1138 prev = f"M_{f}"
1139 nodes.append(make_saver(prev, "tier1_b"))
1140 comp_path = local_root() / "comps" / "probe_tier1_b.comp"
1141 comp_path.write_text(make_comp("\n".join(nodes + splines), len(cases) - 1))
1142 return comp_path, "tier1_b", [(c[0], c[1]) for c in cases]
1143
1144
1145def build_probe_tier1_c():
1146 """Probes Plasma, FilmGrain, CameraShake, and Shake modifier against Fusion 21.1."""
1147 grid = generate_grid_chart()
1148 cases = [
1149 (0, "plasma_default", "Plasma", "", 'Width = Input { Value = 512, }, Height = Input { Value = 512, },'),
1150 (1, "plasma_1circle", "Plasma", "", 'Width = Input { Value = 512, }, Height = Input { Value = 512, }, Circle1Center = Input { Value = { 0.5, 0.5 }, }, Circle1Scale = Input { Value = 0.5, }, Circle2Type = Input { Value = 0, }, Circle3Type = Input { Value = 0, }, Circle4Type = Input { Value = 0, },'),
1151 (2, "plasma_phase0.5", "Plasma", "", 'Width = Input { Value = 512, }, Height = Input { Value = 512, }, Phase = Input { Value = 0.5, }, Scale = Input { Value = 2.0, },'),
1152 (3, "plasma_4circles", "Plasma", "", 'Width = Input { Value = 512, }, Height = Input { Value = 512, }, Circle1Center = Input { Value = { 0.2, 0.3 }, }, Circle2Center = Input { Value = { 0.8, 0.7 }, }, Circle3Center = Input { Value = { 0.3, 0.8 }, }, Circle4Center = Input { Value = { 0.7, 0.2 }, },'),
1153 (4, "filmgrain_str0.15", "FilmGrain", "GridLoader", 'MasterStrength = Input { Value = 0.15, }, MasterXSize = Input { Value = 1.5, }, TimeLockSeed = Input { Value = 1, },'),
1154 (5, "filmgrain_str0.4", "FilmGrain", "GridLoader", 'MasterStrength = Input { Value = 0.4, }, MasterXSize = Input { Value = 2.5, }, TimeLockSeed = Input { Value = 1, },'),
1155 (6, "camshake_xy0.05", "CameraShake", "GridLoader", 'XDeviation = Input { Value = 0.05, }, YDeviation = Input { Value = 0.05, }, RotationDeviation = Input { Value = 5.0, }, OverallStrength = Input { Value = 1.0, },'),
1156 (7, "camshake_off", "CameraShake", "GridLoader", 'XDeviation = Input { Value = 0.05, }, YDeviation = Input { Value = 0.05, }, OverallStrength = Input { Value = 0.0, },'),
1157 (8, "shake_mod_t0", "ShakeMod", "GridLoader", ''),
1158 (9, "shake_mod_t9", "ShakeMod", "GridLoader", ''),
1159 ]
1160 nodes = [
1161 make_loader("GridLoader", grid, post_mult=1),
1162 """\t\tBlackBG = Background {
1163\t\t\tInputs = { Width = Input { Value = 512, }, Height = Input { Value = 512, }, TopLeftAlpha = Input { Value = 1, }, },
1164\t\t},
1165\t\tShakeTest = Shake {
1166\t\t\tInputs = {
1167\t\t\t\tSmoothness = Input { Value = 3.0, },
1168\t\t\t\tRandomSeed = Input { Value = 42, },
1169\t\t\t\tXMinimum = Input { Value = 0.2, },
1170\t\t\t\tXMaximum = Input { Value = 0.8, },
1171\t\t\t},
1172\t\t},
1173\t\tShakeBG = Background {
1174\t\t\tInputs = {
1175\t\t\t\tWidth = Input { Value = 512, }, Height = Input { Value = 512, },
1176\t\t\t\tTopLeftRed = Input { SourceOp = "ShakeTest", Source = "X", },
1177\t\t\t\tTopLeftGreen = Input { Value = 0.3, }, TopLeftBlue = Input { Value = 0.5, }, TopLeftAlpha = Input { Value = 1, },
1178\t\t\t},
1179\t\t},""",
1180 ]
1181 splines = []
1182 prev = "BlackBG"
1183 for f, label, kind, src_in, extra in cases:
1184 bl = {c[0]: (1.0 if c[0] == f else 0.0) for c in cases}
1185 sname = f"T1c_{f}_Blend"
1186 splines.append(step_spline(sname, bl))
1187 if kind == "ShakeMod":
1188 fg_op = "ShakeBG"
1189 elif kind == "Plasma":
1190 nodes.append(f"""\t\tOp_{f} = Plasma {{
1191\t\t\tInputs = {{ {extra} }},
1192\t\t}},""")
1193 fg_op = f"Op_{f}"
1194 else:
1195 nodes.append(f"""\t\tOp_{f} = {kind} {{
1196\t\t\tInputs = {{
1197\t\t\t\tInput = Input {{ SourceOp = "{src_in}", Source = "Output", }},
1198\t\t\t\t{extra}
1199\t\t\t}},
1200\t\t}},""")
1201 fg_op = f"Op_{f}"
1202 nodes.append(f"""\t\tM_{f} = Merge {{
1203\t\t\tInputs = {{
1204\t\t\t\tBlend = Input {{ SourceOp = "{sname}", Source = "Value", }},
1205\t\t\t\tBackground = Input {{ SourceOp = "{prev}", Source = "Output", }},
1206\t\t\t\tForeground = Input {{ SourceOp = "{fg_op}", Source = "Output", }},
1207\t\t\t}},
1208\t\t}},""")
1209 prev = f"M_{f}"
1210 nodes.append(make_saver(prev, "tier1_c"))
1211 comp_path = local_root() / "comps" / "probe_tier1_c.comp"
1212 comp_path.write_text(make_comp("\n".join(nodes + splines), len(cases) - 1))
1213 return comp_path, "tier1_c", [(c[0], c[1]) for c in cases]
1214
1215
1216def build_probe_tier1_d():
1217 """Probes SetDomain (Adjust shrink/expand, Set) and ChangeDepth (int8/int16/float16/float32 HDR roundtrip)."""
1218 grid = generate_grid_chart()
1219 cases = [
1220 (0, "setdom_adjust_shrink"),
1221 (1, "setdom_set_box"),
1222 (2, "setdom_expand_blur"),
1223 (3, "depth_int8_hdr_clip"),
1224 (4, "depth_int16_hdr_clip"),
1225 (5, "depth_float16_hdr_keep"),
1226 (6, "depth_float32_hdr_keep"),
1227 (7, "depth_float16_hdr_blur"),
1228 (8, "bg_depth3_hdr_keep"),
1229 ]
1230 nodes = [
1231 make_loader("GridLoader", grid, post_mult=1),
1232 """\t\tBlackBG = Background {
1233\t\t\tInputs = { Width = Input { Value = 512, }, Height = Input { Value = 512, }, TopLeftAlpha = Input { Value = 1, }, },
1234\t\t},
1235\t\t-- f00: SetDomain Adjust shrink
1236\t\tOp_0 = SetDomain {
1237\t\t\tInputs = {
1238\t\t\t\tInput = Input { SourceOp = "GridLoader", Source = "Output", },
1239\t\t\t\tAdjustLeft = Input { Value = 0.15, },
1240\t\t\t\tAdjustBottom = Input { Value = 0.10, },
1241\t\t\t\tAdjustRight = Input { Value = -0.20, },
1242\t\t\t\tAdjustTop = Input { Value = -0.15, },
1243\t\t\t},
1244\t\t},
1245\t\t-- f01: SetDomain Set mode
1246\t\tOp_1 = SetDomain {
1247\t\t\tInputs = {
1248\t\t\t\tInput = Input { SourceOp = "GridLoader", Source = "Output", },
1249\t\t\t\tMode = Input { Value = FuID { "Set" }, },
1250\t\t\t\tLeft = Input { Value = 0.2, },
1251\t\t\t\tBottom = Input { Value = 0.1, },
1252\t\t\t\tRight = Input { Value = 0.8, },
1253\t\t\t\tTop = Input { Value = 0.9, },
1254\t\t\t},
1255\t\t},
1256\t\t-- f02: SetDomain Adjust expand + Blur
1257\t\tSD_2 = SetDomain {
1258\t\t\tInputs = {
1259\t\t\t\tInput = Input { SourceOp = "GridLoader", Source = "Output", },
1260\t\t\t\tAdjustLeft = Input { Value = -0.2, },
1261\t\t\t\tAdjustBottom = Input { Value = -0.2, },
1262\t\t\t\tAdjustRight = Input { Value = 0.2, },
1263\t\t\t\tAdjustTop = Input { Value = 0.2, },
1264\t\t\t},
1265\t\t},
1266\t\tOp_2 = Blur {
1267\t\t\tInputs = {
1268\t\t\t\tInput = Input { SourceOp = "SD_2", Source = "Output", },
1269\t\t\t\tXBlurSize = Input { Value = 15.0, },
1270\t\t\t},
1271\t\t},
1272\t\t-- f03..f06: ChangeDepth 1(int8), 2(int16), 3(float16), 4(float32) -> Gain 4.0 -> Gain 0.25
1273\t\tCD_3 = ChangeDepth { Inputs = { Input = Input { SourceOp = "GridLoader", Source = "Output", }, Depth = Input { Value = 1, }, }, },
1274\t\tBC3_Up = BrightnessContrast { Inputs = { Input = Input { SourceOp = "CD_3", Source = "Output", }, Gain = Input { Value = 4.0, }, }, },
1275\t\tOp_3 = BrightnessContrast { Inputs = { Input = Input { SourceOp = "BC3_Up", Source = "Output", }, Gain = Input { Value = 0.25, }, }, },
1276
1277\t\tCD_4 = ChangeDepth { Inputs = { Input = Input { SourceOp = "GridLoader", Source = "Output", }, Depth = Input { Value = 2, }, }, },
1278\t\tBC4_Up = BrightnessContrast { Inputs = { Input = Input { SourceOp = "CD_4", Source = "Output", }, Gain = Input { Value = 4.0, }, }, },
1279\t\tOp_4 = BrightnessContrast { Inputs = { Input = Input { SourceOp = "BC4_Up", Source = "Output", }, Gain = Input { Value = 0.25, }, }, },
1280
1281\t\tCD_5 = ChangeDepth { Inputs = { Input = Input { SourceOp = "GridLoader", Source = "Output", }, Depth = Input { Value = 3, }, }, },
1282\t\tBC5_Up = BrightnessContrast { Inputs = { Input = Input { SourceOp = "CD_5", Source = "Output", }, Gain = Input { Value = 4.0, }, }, },
1283\t\tOp_5 = BrightnessContrast { Inputs = { Input = Input { SourceOp = "BC5_Up", Source = "Output", }, Gain = Input { Value = 0.25, }, }, },
1284
1285\t\tCD_6 = ChangeDepth { Inputs = { Input = Input { SourceOp = "GridLoader", Source = "Output", }, Depth = Input { Value = 4, }, }, },
1286\t\tBC6_Up = BrightnessContrast { Inputs = { Input = Input { SourceOp = "CD_6", Source = "Output", }, Gain = Input { Value = 4.0, }, }, },
1287\t\tOp_6 = BrightnessContrast { Inputs = { Input = Input { SourceOp = "BC6_Up", Source = "Output", }, Gain = Input { Value = 0.25, }, }, },
1288
1289\t\t-- f07: float16 HDR Blur bloom survival
1290\t\tCD_7 = ChangeDepth { Inputs = { Input = Input { SourceOp = "GridLoader", Source = "Output", }, Depth = Input { Value = 3, }, }, },
1291\t\tBC7_Up = BrightnessContrast { Inputs = { Input = Input { SourceOp = "CD_7", Source = "Output", }, Gain = Input { Value = 4.0, }, }, },
1292\t\tBl_7 = Blur { Inputs = { Input = Input { SourceOp = "BC7_Up", Source = "Output", }, XBlurSize = Input { Value = 15.0, }, }, },
1293\t\tOp_7 = BrightnessContrast { Inputs = { Input = Input { SourceOp = "Bl_7", Source = "Output", }, Gain = Input { Value = 0.25, }, }, },
1294
1295\t\t-- f08: Background Depth=3 (float16) HDR survival
1296\t\tBG_8 = Background { Inputs = { Width = Input { Value = 512, }, Height = Input { Value = 512, }, Depth = Input { Value = 3, }, TopLeftRed = Input { Value = 0.8, }, TopLeftGreen = Input { Value = 0.4, }, TopLeftBlue = Input { Value = 0.2, }, TopLeftAlpha = Input { Value = 1, }, }, },
1297\t\tBC8_Up = BrightnessContrast { Inputs = { Input = Input { SourceOp = "BG_8", Source = "Output", }, Gain = Input { Value = 4.0, }, }, },
1298\t\tOp_8 = BrightnessContrast { Inputs = { Input = Input { SourceOp = "BC8_Up", Source = "Output", }, Gain = Input { Value = 0.25, }, }, },""",
1299 ]
1300 splines = []
1301 prev = "BlackBG"
1302 for f, label in cases:
1303 bl = {c[0]: (1.0 if c[0] == f else 0.0) for c in cases}
1304 sname = f"T1d_{f}_Blend"
1305 splines.append(step_spline(sname, bl))
1306 nodes.append(f"""\t\tM_{f} = Merge {{
1307\t\t\tInputs = {{
1308\t\t\t\tBlend = Input {{ SourceOp = "{sname}", Source = "Value", }},
1309\t\t\t\tBackground = Input {{ SourceOp = "{prev}", Source = "Output", }},
1310\t\t\t\tForeground = Input {{ SourceOp = "Op_{f}", Source = "Output", }},
1311\t\t\t}},
1312\t\t}},""")
1313 prev = f"M_{f}"
1314 nodes.append(make_saver(prev, "tier1_d"))
1315 comp_path = local_root() / "comps" / "probe_tier1_d.comp"
1316 comp_path.write_text(make_comp("\n".join(nodes + splines), len(cases) - 1))
1317 return comp_path, "tier1_d", cases
1318
1319
1320def build_probe_mask_softedge():
1321 """Shale #8 probe: Mask SoftEdge (small..huge), BorderWidth, Solid=0, Filter, ClippingMode, BitmapMask, PolylineMask, and Blur ClippingMode=None + Merge shift."""
1322 grid = generate_grid_chart()
1323 cases = [
1324 (0, "ellipse_soft0.01"),
1325 (1, "ellipse_soft0.05_small"),
1326 (2, "ellipse_soft0.18_large"),
1327 (3, "rect_soft0.06_clip_none_edge"),
1328 (4, "rect_soft0.06_clip_frame_edge"),
1329 (5, "rect_soft0.06_box"),
1330 (6, "rect_border0.04_solid0"),
1331 (7, "ellipse_border0.03_soft0.02"),
1332 (8, "bitmap_luma_low_high_soft0.04"),
1333 (9, "bitmap_alpha_soft0.25_inv"),
1334 (10, "poly_soft0.08"),
1335 (11, "blur_clip_none_merge_shift"),
1336 ]
1337 nodes = [
1338 make_loader("GridLoader", grid, post_mult=1),
1339 """\t\tBlackBG = Background {
1340\t\t\tInputs = { Width = Input { Value = 640, }, Height = Input { Value = 360, }, TopLeftAlpha = Input { Value = 1, }, },
1341\t\t},
1342\t\tWhiteFG = Background {
1343\t\t\tInputs = { Width = Input { Value = 640, }, Height = Input { Value = 360, }, TopLeftRed = Input { Value = 1, }, TopLeftGreen = Input { Value = 1, }, TopLeftBlue = Input { Value = 1, }, TopLeftAlpha = Input { Value = 1, }, },
1344\t\t},
1345\t\t-- f00: Ellipse SoftEdge=0.01
1346\t\tMask_0 = EllipseMask { Inputs = { MaskWidth = Input { Value = 640, }, MaskHeight = Input { Value = 360, }, Width = Input { Value = 0.4, }, Height = Input { Value = 0.4, }, SoftEdge = Input { Value = 0.01, }, }, },
1347\t\tOp_0 = Merge { Inputs = { Background = Input { SourceOp = "BlackBG", Source = "Output", }, Foreground = Input { SourceOp = "WhiteFG", Source = "Output", }, EffectMask = Input { SourceOp = "Mask_0", Source = "Mask", }, }, },
1348
1349\t\t-- f01: Small Ellipse SoftEdge=0.05 (like 20_falling Ellipse1)
1350\t\tMask_1 = EllipseMask { Inputs = { MaskWidth = Input { Value = 640, }, MaskHeight = Input { Value = 360, }, Center = Input { Value = { 0.35, 0.45 }, }, Width = Input { Value = 0.12, }, Height = Input { Value = 0.12, }, SoftEdge = Input { Value = 0.05, }, Filter = Input { Value = FuID { "Fast Gaussian" }, }, ClippingMode = Input { Value = FuID { "None" }, }, }, },
1351\t\tOp_1 = Merge { Inputs = { Background = Input { SourceOp = "BlackBG", Source = "Output", }, Foreground = Input { SourceOp = "WhiteFG", Source = "Output", }, EffectMask = Input { SourceOp = "Mask_1", Source = "Mask", }, }, },
1352
1353\t\t-- f02: Large Ellipse SoftEdge=0.18
1354\t\tMask_2 = EllipseMask { Inputs = { MaskWidth = Input { Value = 640, }, MaskHeight = Input { Value = 360, }, Width = Input { Value = 0.35, }, Height = Input { Value = 0.35, }, SoftEdge = Input { Value = 0.18, }, Filter = Input { Value = FuID { "Fast Gaussian" }, }, }, },
1355\t\tOp_2 = Merge { Inputs = { Background = Input { SourceOp = "BlackBG", Source = "Output", }, Foreground = Input { SourceOp = "WhiteFG", Source = "Output", }, EffectMask = Input { SourceOp = "Mask_2", Source = "Mask", }, }, },
1356
1357\t\t-- f03: Rect SoftEdge=0.06 near bottom edge, ClippingMode=None
1358\t\tMask_3 = RectangleMask { Inputs = { MaskWidth = Input { Value = 640, }, MaskHeight = Input { Value = 360, }, Center = Input { Value = { 0.5, 0.25 }, }, Width = Input { Value = 0.9, }, Height = Input { Value = 0.5, }, SoftEdge = Input { Value = 0.06, }, ClippingMode = Input { Value = FuID { "None" }, }, }, },
1359\t\tOp_3 = Merge { Inputs = { Background = Input { SourceOp = "BlackBG", Source = "Output", }, Foreground = Input { SourceOp = "WhiteFG", Source = "Output", }, EffectMask = Input { SourceOp = "Mask_3", Source = "Mask", }, }, },
1360
1361\t\t-- f04: Rect SoftEdge=0.06 near bottom edge, ClippingMode=Frame
1362\t\tMask_4 = RectangleMask { Inputs = { MaskWidth = Input { Value = 640, }, MaskHeight = Input { Value = 360, }, Center = Input { Value = { 0.5, 0.25 }, }, Width = Input { Value = 0.9, }, Height = Input { Value = 0.5, }, SoftEdge = Input { Value = 0.06, }, ClippingMode = Input { Value = FuID { "Frame" }, }, }, },
1363\t\tOp_4 = Merge { Inputs = { Background = Input { SourceOp = "BlackBG", Source = "Output", }, Foreground = Input { SourceOp = "WhiteFG", Source = "Output", }, EffectMask = Input { SourceOp = "Mask_4", Source = "Mask", }, }, },
1364
1365\t\t-- f05: Rect SoftEdge=0.06 Filter=Box
1366\t\tMask_5 = RectangleMask { Inputs = { MaskWidth = Input { Value = 640, }, MaskHeight = Input { Value = 360, }, Width = Input { Value = 0.45, }, Height = Input { Value = 0.45, }, SoftEdge = Input { Value = 0.06, }, Filter = Input { Value = FuID { "Box" }, }, }, },
1367\t\tOp_5 = Merge { Inputs = { Background = Input { SourceOp = "BlackBG", Source = "Output", }, Foreground = Input { SourceOp = "WhiteFG", Source = "Output", }, EffectMask = Input { SourceOp = "Mask_5", Source = "Mask", }, }, },
1368
1369\t\t-- f06: Rect BorderWidth=0.04 Solid=0 (outline)
1370\t\tMask_6 = RectangleMask { Inputs = { MaskWidth = Input { Value = 640, }, MaskHeight = Input { Value = 360, }, Width = Input { Value = 0.45, }, Height = Input { Value = 0.45, }, Solid = Input { Value = 0, }, BorderWidth = Input { Value = 0.04, }, }, },
1371\t\tOp_6 = Merge { Inputs = { Background = Input { SourceOp = "BlackBG", Source = "Output", }, Foreground = Input { SourceOp = "WhiteFG", Source = "Output", }, EffectMask = Input { SourceOp = "Mask_6", Source = "Mask", }, }, },
1372
1373\t\t-- f07: Ellipse BorderWidth=0.03 Solid=1 SoftEdge=0.02
1374\t\tMask_7 = EllipseMask { Inputs = { MaskWidth = Input { Value = 640, }, MaskHeight = Input { Value = 360, }, Width = Input { Value = 0.30, }, Height = Input { Value = 0.30, }, Solid = Input { Value = 1, }, BorderWidth = Input { Value = 0.03, }, SoftEdge = Input { Value = 0.02, }, }, },
1375\t\tOp_7 = Merge { Inputs = { Background = Input { SourceOp = "BlackBG", Source = "Output", }, Foreground = Input { SourceOp = "WhiteFG", Source = "Output", }, EffectMask = Input { SourceOp = "Mask_7", Source = "Mask", }, }, },
1376
1377\t\t-- f08: BitmapMask Luminance + Low/High + SoftEdge=0.04
1378\t\tMask_8 = BitmapMask { Inputs = { Image = Input { SourceOp = "GridLoader", Source = "Output", }, Channel = Input { Value = FuID { "Luminance" }, }, Low = Input { Value = 0.2, }, High = Input { Value = 0.8, }, SoftEdge = Input { Value = 0.04, }, }, },
1379\t\tOp_8 = Merge { Inputs = { Background = Input { SourceOp = "BlackBG", Source = "Output", }, Foreground = Input { SourceOp = "WhiteFG", Source = "Output", }, EffectMask = Input { SourceOp = "Mask_8", Source = "Mask", }, }, },
1380
1381\t\t-- f09: BitmapMask Alpha + huge SoftEdge=0.25 + Invert=1
1382\t\tBmSrc_9 = RectangleMask { Inputs = { MaskWidth = Input { Value = 640, }, MaskHeight = Input { Value = 360, }, Width = Input { Value = 0.35, }, Height = Input { Value = 0.35, }, }, },
1383\t\tBmImg_9 = Merge { Inputs = { Background = Input { SourceOp = "BlackBG", Source = "Output", }, Foreground = Input { SourceOp = "WhiteFG", Source = "Output", }, EffectMask = Input { SourceOp = "BmSrc_9", Source = "Mask", }, }, },
1384\t\tMask_9 = BitmapMask { Inputs = { Image = Input { SourceOp = "BmImg_9", Source = "Output", }, Channel = Input { Value = FuID { "Luminance" }, }, SoftEdge = Input { Value = 0.25, }, Invert = Input { Value = 1, }, }, },
1385\t\tOp_9 = Merge { Inputs = { Background = Input { SourceOp = "BlackBG", Source = "Output", }, Foreground = Input { SourceOp = "WhiteFG", Source = "Output", }, EffectMask = Input { SourceOp = "Mask_9", Source = "Mask", }, }, },
1386
1387\t\t-- f10: PolylineMask SoftEdge=0.08
1388\t\tMask_10 = PolylineMask {
1389\t\t\tInputs = {
1390\t\t\t\tMaskWidth = Input { Value = 640, },
1391\t\t\t\tMaskHeight = Input { Value = 360, },
1392\t\t\t\tSoftEdge = Input { Value = 0.08, },
1393\t\t\t\tPolyline = Input {
1394\t\t\t\t\tValue = Polyline {
1395\t\t\t\t\t\tClosed = true,
1396\t\t\t\t\t\tPoints = {
1397\t\t\t\t\t\t\t{ Linear = true, X = -0.25, Y = -0.20, RX = 0.16, RY = 0 },
1398\t\t\t\t\t\t\t{ Linear = true, X = 0.25, Y = -0.20, LX = -0.16, LY = 0, RX = -0.08, RY = 0.14 },
1399\t\t\t\t\t\t\t{ Linear = true, X = 0.0, Y = 0.25, LX = 0.08, LY = -0.14 },
1400\t\t\t\t\t\t},
1401\t\t\t\t\t},
1402\t\t\t\t},
1403\t\t\t},
1404\t\t},
1405\t\tOp_10 = Merge { Inputs = { Background = Input { SourceOp = "BlackBG", Source = "Output", }, Foreground = Input { SourceOp = "WhiteFG", Source = "Output", }, EffectMask = Input { SourceOp = "Mask_10", Source = "Mask", }, }, },
1406
1407\t\t-- f11: Blur ClippingMode=None on solid WhiteFG shifted down by Merge (20_falling Blur2->Merge7!)
1408\t\tBl_11 = Blur { Inputs = { Input = Input { SourceOp = "WhiteFG", Source = "Output", }, Filter = Input { Value = FuID { "Fast Gaussian" }, }, XBlurSize = Input { Value = 25.0, }, ClippingMode = Input { Value = FuID { "None" }, }, }, },
1409\t\tOp_11 = Merge { Inputs = { Background = Input { SourceOp = "BlackBG", Source = "Output", }, Foreground = Input { SourceOp = "Bl_11", Source = "Output", }, Center = Input { Value = { 0.5, 0.20 }, }, Size = Input { Value = 1.1, }, }, },""",
1410 ]
1411 splines = []
1412 prev = "BlackBG"
1413 for f, _label in cases:
1414 bl = {c[0]: (1.0 if c[0] == f else 0.0) for c in cases}
1415 sname = f"Mse_{f}_Blend"
1416 splines.append(step_spline(sname, bl))
1417 nodes.append(f"""\t\tSw_{f} = Merge {{
1418\t\t\tInputs = {{
1419\t\t\t\tBlend = Input {{ SourceOp = "{sname}", Source = "Value", }},
1420\t\t\t\tBackground = Input {{ SourceOp = "{prev}", Source = "Output", }},
1421\t\t\t\tForeground = Input {{ SourceOp = "Op_{f}", Source = "Output", }},
1422\t\t\t}},
1423\t\t}},""")
1424 prev = f"Sw_{f}"
1425 nodes.append(make_saver(prev, "mask_softedge"))
1426 comp_path = local_root() / "comps" / "probe_mask_softedge.comp"
1427 comp_path.write_text(make_comp("\n".join(nodes + splines), len(cases) - 1, w=640, h=360))
1428 return comp_path, "mask_softedge", cases
1429
1430
1431def build_probe_displace_wave():
1432 """Shale #9 probe: Displace XY default channels/offset/scale, CustomTool sine wave + Lua expr, FastNoise Discontinuous/Type=1/high-Seethe."""
1433 grid = generate_grid_chart()
1434 cases = [
1435 (0, "disp_xy_defaults_grid"),
1436 (1, "disp_xy_grad_off0"),
1437 (2, "disp_xy_grad_off-0.5"),
1438 (3, "disp_xy_ch1_ch0_off-0.5"),
1439 (4, "disp_custom_wave_expr"),
1440 (5, "fastnoise_disc_detail10_grad"),
1441 (6, "fastnoise_disc_high_seethe"),
1442 (7, "fastnoise_type1_2d_disc"),
1443 (8, "fastnoise_type0_xscale0_disc"),
1444 ]
1445 nodes = [
1446 make_loader("GridLoader", grid, post_mult=1),
1447 """\t\tBlackBG = Background { Inputs = { Width = Input { Value = 512, }, Height = Input { Value = 512, }, TopLeftAlpha = Input { Value = 1, }, }, },
1448\t\tGradH = Background {
1449\t\t\tInputs = {
1450\t\t\t\tWidth = Input { Value = 512, }, Height = Input { Value = 512, },
1451\t\t\t\tType = Input { Value = FuID { "Horizontal" }, },
1452\t\t\t\tTopLeftRed = Input { Value = 0, }, TopLeftGreen = Input { Value = 0, }, TopLeftBlue = Input { Value = 0, }, TopLeftAlpha = Input { Value = 1, },
1453\t\t\t\tTopRightRed = Input { Value = 1, }, TopRightGreen = Input { Value = 0.25, }, TopRightBlue = Input { Value = 0.75, }, TopRightAlpha = Input { Value = 1, },
1454\t\t\t},
1455\t\t},
1456\t\t-- f00: Displace Type=1 default XChannel/YChannel/XOffset/YOffset
1457\t\tOp_0 = Displace {
1458\t\t\tInputs = {
1459\t\t\t\tType = Input { Value = 1, },
1460\t\t\t\tXRefraction = Input { Value = 0.05, },
1461\t\t\t\tYRefraction = Input { Value = 0.05, },
1462\t\t\t\tInput = Input { SourceOp = "GridLoader", Source = "Output", },
1463\t\t\t\tForeground = Input { SourceOp = "GradH", Source = "Output", },
1464\t\t\t},
1465\t\t},
1466\t\t-- f01: Displace Type=1 XOffset=0 XRefraction=0.08
1467\t\tOp_1 = Displace {
1468\t\t\tInputs = {
1469\t\t\t\tType = Input { Value = 1, },
1470\t\t\t\tXOffset = Input { Value = 0.0, },
1471\t\t\t\tXRefraction = Input { Value = 0.08, },
1472\t\t\t\tInput = Input { SourceOp = "GridLoader", Source = "Output", },
1473\t\t\t\tForeground = Input { SourceOp = "GradH", Source = "Output", },
1474\t\t\t},
1475\t\t},
1476\t\t-- f02: Displace Type=1 XOffset=-0.5 XRefraction=0.08
1477\t\tOp_2 = Displace {
1478\t\t\tInputs = {
1479\t\t\t\tType = Input { Value = 1, },
1480\t\t\t\tXOffset = Input { Value = -0.5, },
1481\t\t\t\tXRefraction = Input { Value = 0.08, },
1482\t\t\t\tInput = Input { SourceOp = "GridLoader", Source = "Output", },
1483\t\t\t\tForeground = Input { SourceOp = "GradH", Source = "Output", },
1484\t\t\t},
1485\t\t},
1486\t\t-- f03: Displace Type=1 XChannel=1 YChannel=0 XOffset=-0.5 YOffset=-0.5
1487\t\tOp_3 = Displace {
1488\t\t\tInputs = {
1489\t\t\t\tType = Input { Value = 1, },
1490\t\t\t\tXChannel = Input { Value = 1, },
1491\t\t\t\tYChannel = Input { Value = 0, },
1492\t\t\t\tXOffset = Input { Value = -0.5, },
1493\t\t\t\tYOffset = Input { Value = -0.5, },
1494\t\t\t\tXRefraction = Input { Value = 0.05, },
1495\t\t\t\tYRefraction = Input { Value = 0.05, },
1496\t\t\t\tInput = Input { SourceOp = "GridLoader", Source = "Output", },
1497\t\t\t\tForeground = Input { SourceOp = "GradH", Source = "Output", },
1498\t\t\t},
1499\t\t},
1500\t\t-- f04: CustomTool sine wave + Displace Lua expression
1501\t\tCustomWave1 = Custom {
1502\t\t\tInputs = {
1503\t\t\t\tRedExpression = Input { Value = "sin(x*w*n1 + n2*n1*w)*0.5+0.5", },
1504\t\t\t\tGreenExpression = Input { Value = "sin(y*w*n1 + n2*n1*w)*0.5+0.5", },
1505\t\t\t\tBlueExpression = Input { Value = "0", },
1506\t\t\t\tAlphaExpression = Input { Value = "1", },
1507\t\t\t\tImage1 = Input { SourceOp = "GridLoader", Source = "Output", },
1508\t\t\t\tNumberIn1 = Input { Value = 0.7413, },
1509\t\t\t\tNumberIn2 = Input { Value = 1.5, },
1510\t\t\t\tWaveDirection = Input { Value = 0, },
1511\t\t\t\tWaveAmp = Input { Value = 0.04, },
1512\t\t\t},
1513\t\t\tUserControls = ordered() {
1514\t\t\t\tWaveDirection = { INP_Default = 0, INPID_InputControl = "ComboControl", LINKID_DataType = "Number", },
1515\t\t\t\tWaveAmp = { INP_Default = 0.04, INPID_InputControl = "SliderControl", LINKID_DataType = "Number", },
1516\t\t\t},
1517\t\t},
1518\t\tOp_4 = Displace {
1519\t\t\tInputs = {
1520\t\t\t\tType = Input { Value = 1, },
1521\t\t\t\tXChannel = Input { Value = 1, },
1522\t\t\t\tYChannel = Input { Value = 0, },
1523\t\t\t\tXOffset = Input { Value = -0.5, },
1524\t\t\t\tYOffset = Input { Value = -0.5, },
1525\t\t\t\tXRefraction = Input { Expression = "(CustomWave1.WaveDirection == 0) and (CustomWave1.WaveAmp) or 0", },
1526\t\t\t\tYRefraction = Input { Expression = "(CustomWave1.WaveDirection == 1) and (CustomWave1.WaveAmp) or 0", },
1527\t\t\t\tInput = Input { SourceOp = "GridLoader", Source = "Output", },
1528\t\t\t\tForeground = Input { SourceOp = "CustomWave1", Source = "Output", },
1529\t\t\t},
1530\t\t},
1531\t\t-- f05: FastNoise Discontinuous=1 Detail=10 XScale=0 YScale=80 Type=1 Gradient
1532\t\tOp_5 = FastNoise {
1533\t\t\tInputs = {
1534\t\t\t\tWidth = Input { Value = 512, }, Height = Input { Value = 512, },
1535\t\t\t\tDetail = Input { Value = 10, },
1536\t\t\t\tLockXY = Input { Value = 0, },
1537\t\t\t\tXScale = Input { Value = 0, },
1538\t\t\t\tYScale = Input { Value = 80, },
1539\t\t\t\tSeethe = Input { Value = 8.377, },
1540\t\t\t\tDiscontinuous = Input { Value = 1, },
1541\t\t\t\tType = Input { Value = 1, },
1542\t\t\t\tColor1Alpha = Input { Value = 1, },
1543\t\t\t\tGradient = Input {
1544\t\t\t\t\tValue = Gradient {
1545\t\t\t\t\t\tColors = {
1546\t\t\t\t\t\t\t[0] = { 0, 0, 0, 1 },
1547\t\t\t\t\t\t\t[0.428] = { 0.5, 0, 0, 1 },
1548\t\t\t\t\t\t\t[0.552] = { 0.5, 0, 0, 1 },
1549\t\t\t\t\t\t\t[1] = { 1, 1, 1, 1 },
1550\t\t\t\t\t\t},
1551\t\t\t\t\t},
1552\t\t\t\t},
1553\t\t\t},
1554\t\t},
1555\t\t-- f06: FastNoise Discontinuous=1 Detail=10 XScale=10 YScale=10 Seethe=29820
1556\t\tOp_6 = FastNoise {
1557\t\t\tInputs = {
1558\t\t\t\tWidth = Input { Value = 512, }, Height = Input { Value = 512, },
1559\t\t\t\tDetail = Input { Value = 10, },
1560\t\t\t\tXScale = Input { Value = 10, },
1561\t\t\t\tYScale = Input { Value = 10, },
1562\t\t\t\tSeethe = Input { Value = 29820, },
1563\t\t\t\tDiscontinuous = Input { Value = 1, },
1564\t\t\t\tColor1Alpha = Input { Value = 1, },
1565\t\t\t},
1566\t\t},
1567\t\t-- f07: FastNoise Type=1 linear 0..1 gradient, 2D (XScale=10, YScale=10), Discontinuous=1
1568\t\tOp_7 = FastNoise {
1569\t\t\tInputs = {
1570\t\t\t\tWidth = Input { Value = 512, }, Height = Input { Value = 512, },
1571\t\t\t\tDetail = Input { Value = 10, },
1572\t\t\t\tXScale = Input { Value = 10, },
1573\t\t\t\tYScale = Input { Value = 10, },
1574\t\t\t\tSeethe = Input { Value = 8.377, },
1575\t\t\t\tDiscontinuous = Input { Value = 1, },
1576\t\t\t\tType = Input { Value = 1, },
1577\t\t\t\tGradient = Input { Value = Gradient { Colors = { [0] = { 0, 0, 0, 1 }, [1] = { 1, 1, 1, 1 } }, }, },
1578\t\t\t},
1579\t\t},
1580\t\t-- f08: FastNoise Type=0 TwoColor, XScale=0 YScale=80, Discontinuous=1
1581\t\tOp_8 = FastNoise {
1582\t\t\tInputs = {
1583\t\t\t\tWidth = Input { Value = 512, }, Height = Input { Value = 512, },
1584\t\t\t\tDetail = Input { Value = 10, },
1585\t\t\t\tLockXY = Input { Value = 0, },
1586\t\t\t\tXScale = Input { Value = 0, },
1587\t\t\t\tYScale = Input { Value = 80, },
1588\t\t\t\tSeethe = Input { Value = 8.377, },
1589\t\t\t\tDiscontinuous = Input { Value = 1, },
1590\t\t\t\tColor1Alpha = Input { Value = 1, },
1591\t\t\t},
1592\t\t},""",
1593 ]
1594 splines = []
1595 prev = "BlackBG"
1596 for f, _label in cases:
1597 bl = {c[0]: (1.0 if c[0] == f else 0.0) for c in cases}
1598 sname = f"Dw_{f}_Blend"
1599 splines.append(step_spline(sname, bl))
1600 nodes.append(f"""\t\tSw_{f} = Merge {{
1601\t\t\tInputs = {{
1602\t\t\t\tBlend = Input {{ SourceOp = "{sname}", Source = "Value", }},
1603\t\t\t\tBackground = Input {{ SourceOp = "{prev}", Source = "Output", }},
1604\t\t\t\tForeground = Input {{ SourceOp = "Op_{f}", Source = "Output", }},
1605\t\t\t}},
1606\t\t}},""")
1607 prev = f"Sw_{f}"
1608 nodes.append(make_saver(prev, "displace_wave"))
1609 comp_path = local_root() / "comps" / "probe_displace_wave.comp"
1610 comp_path.write_text(make_comp("\n".join(nodes + splines), len(cases) - 1))
1611 return comp_path, "displace_wave", cases
1612
1613
1614def build_probe_vortex_cc():
1615 """Shale #10 probe: Vortex warp + ColorCorrector TintMode & Shadows/Midtones/Highlights wheels."""
1616 grid = generate_grid_chart()
1617 chart = generate_color_chart()
1618 cases = [
1619 (0, "vortex_default"),
1620 (1, "vortex_s0.6_a2.5_p2"),
1621 (2, "vortex_s3.82_a2.1_p3.3"),
1622 (3, "vortex_offcenter_neg"),
1623 (4, "cc_tintmode0_len1_sat1.52"),
1624 (5, "cc_tintmode1_len1_sat1.52"),
1625 (6, "cc_tintmode0_len0.5"),
1626 (7, "cc_tintmode1_len0.5"),
1627 (8, "cc_smh_wheels"),
1628 (9, "cc_smh_lgg"),
1629 ]
1630 nodes = [
1631 make_loader("GridLoader", grid, post_mult=1),
1632 make_loader("ChartLoader", chart, post_mult=1),
1633 """\t\tBlackBG = Background { Inputs = { Width = Input { Value = 512, }, Height = Input { Value = 512, }, TopLeftAlpha = Input { Value = 1, }, }, },
1634\t\tOp_0 = Vortex { Inputs = { Input = Input { SourceOp = "GridLoader", Source = "Output", }, Size = Input { Value = 0.5, }, Angle = Input { Value = 1.0, }, Power = Input { Value = 1.0, }, }, },
1635\t\tOp_1 = Vortex { Inputs = { Input = Input { SourceOp = "GridLoader", Source = "Output", }, Size = Input { Value = 0.6, }, Angle = Input { Value = 2.5, }, Power = Input { Value = 2.0, }, }, },
1636\t\tOp_2 = Vortex { Inputs = { Input = Input { SourceOp = "GridLoader", Source = "Output", }, Size = Input { Value = 3.82, }, Angle = Input { Value = 2.1, }, Power = Input { Value = 3.3, }, }, },
1637\t\tOp_3 = Vortex { Inputs = { Input = Input { SourceOp = "GridLoader", Source = "Output", }, Center = Input { Value = { 0.3, 0.7 }, }, Size = Input { Value = 0.5, }, Angle = Input { Value = -2.0, }, Power = Input { Value = 1.5, }, }, },
1638\t\tOp_4 = ColorCorrector { Inputs = { Input = Input { SourceOp = "ChartLoader", Source = "Output", }, WheelTintAngle1 = Input { Value = -0.24, }, WheelTintLength1 = Input { Value = 1.0, }, WheelSaturation1 = Input { Value = 1.52, }, TintMode = Input { Value = 0, }, }, },
1639\t\tOp_5 = ColorCorrector { Inputs = { Input = Input { SourceOp = "ChartLoader", Source = "Output", }, WheelTintAngle1 = Input { Value = -0.24, }, WheelTintLength1 = Input { Value = 1.0, }, WheelSaturation1 = Input { Value = 1.52, }, TintMode = Input { Value = 1, }, }, },
1640\t\tOp_6 = ColorCorrector { Inputs = { Input = Input { SourceOp = "ChartLoader", Source = "Output", }, WheelTintAngle1 = Input { Value = -0.24, }, WheelTintLength1 = Input { Value = 0.5, }, TintMode = Input { Value = 0, }, }, },
1641\t\tOp_7 = ColorCorrector { Inputs = { Input = Input { SourceOp = "ChartLoader", Source = "Output", }, WheelTintAngle1 = Input { Value = -0.24, }, WheelTintLength1 = Input { Value = 0.5, }, TintMode = Input { Value = 1, }, }, },
1642\t\tOp_8 = ColorCorrector { Inputs = { Input = Input { SourceOp = "ChartLoader", Source = "Output", }, WheelTintAngle2 = Input { Value = 0.1, }, WheelTintLength2 = Input { Value = 0.6, }, WheelHue3 = Input { Value = 0.2, }, WheelSaturation4 = Input { Value = 1.5, }, }, },
1643\t\tOp_9 = ColorCorrector { Inputs = { Input = Input { SourceOp = "ChartLoader", Source = "Output", }, ShadowsRGBGain = Input { Value = 0.7, }, MidtonesRGBGamma = Input { Value = 1.4, }, HighlightsRGBGain = Input { Value = 1.25, }, }, },""",
1644 ]
1645 splines = []
1646 prev = "BlackBG"
1647 for f, _label in cases:
1648 bl = {c[0]: (1.0 if c[0] == f else 0.0) for c in cases}
1649 sname = f"Vcc_{f}_Blend"
1650 splines.append(step_spline(sname, bl))
1651 nodes.append(f"""\t\tSw_{f} = Merge {{
1652\t\t\tInputs = {{
1653\t\t\t\tBlend = Input {{ SourceOp = "{sname}", Source = "Value", }},
1654\t\t\t\tBackground = Input {{ SourceOp = "{prev}", Source = "Output", }},
1655\t\t\t\tForeground = Input {{ SourceOp = "Op_{f}", Source = "Output", }},
1656\t\t\t}},
1657\t\t}},""")
1658 prev = f"Sw_{f}"
1659 nodes.append(make_saver(prev, "vortex_cc"))
1660 comp_path = local_root() / "comps" / "probe_vortex_cc.comp"
1661 comp_path.write_text(make_comp("\n".join(nodes + splines), len(cases) - 1))
1662 return comp_path, "vortex_cc", cases
1663
1664
1665def build_probe_moon_3d():
1666 """Shale #10 probe: Shape3D Sphere default radius + 1:1 Camera3D w/ 16:9 Aperture + mismatched BG/FG Merge Size + FastNoise Contrast/Brightness."""
1667 grid = generate_grid_chart()
1668 cases = [
1669 (0, "sphere_cam_1x1_ap16x9"),
1670 (1, "merge_bg1024x512_fg256_s0.6"),
1671 (2, "fastnoise_low_contrast_neg_bright"),
1672 ]
1673 nodes = [
1674 make_loader("GridLoader", grid, post_mult=1),
1675 """\t\tBlackBG = Background { Inputs = { Width = Input { Value = 512, }, Height = Input { Value = 512, }, TopLeftAlpha = Input { Value = 1, }, }, },
1676\t\tWhite256 = Background { Inputs = { Width = Input { Value = 256, }, Height = Input { Value = 256, }, TopLeftRed = Input { Value = 1, }, TopLeftGreen = Input { Value = 0.8, }, TopLeftBlue = Input { Value = 0.2, }, TopLeftAlpha = Input { Value = 1, }, }, },
1677\t\tDark1024 = Background { Inputs = { Width = Input { Value = 1024, }, Height = Input { Value = 512, }, TopLeftRed = Input { Value = 0.1, }, TopLeftGreen = Input { Value = 0.1, }, TopLeftBlue = Input { Value = 0.2, }, TopLeftAlpha = Input { Value = 1, }, }, },
1678\t\t-- f00: Exact 60_moon_guide_u Shape3D1 + Camera3D1 + Renderer3D1 (512x512 1:1 with 16:9 Aperture)
1679\t\tSph0 = Shape3D {
1680\t\t\tInputs = {
1681\t\t\t\tShape = Input { Value = FuID { "SurfaceSphereInputs" }, },
1682\t\t\t\t["MtlStdInputs.Diffuse.Color.Red"] = Input { Value = 0.8, },
1683\t\t\t\t["MtlStdInputs.Diffuse.Color.Green"] = Input { Value = 0.8, },
1684\t\t\t\t["MtlStdInputs.Diffuse.Color.Blue"] = Input { Value = 0.8, },
1685\t\t\t},
1686\t\t},
1687\t\tCam0 = Camera3D {
1688\t\t\tInputs = {
1689\t\t\t\t["Transform3DOp.Translate.Z"] = Input { Value = 6.17286473705227, },
1690\t\t\t\tAoV = Input { Value = 19.2642683071402, },
1691\t\t\t\tFilmGate = Input { Value = FuID { "BMD_URSA_4K_16x9" }, },
1692\t\t\t\tApertureW = Input { Value = 0.831496062992126, },
1693\t\t\t\tApertureH = Input { Value = 0.467716535433071, },
1694\t\t\t},
1695\t\t},
1696\t\tM3D0 = Merge3D { Inputs = { SceneInput1 = Input { SourceOp = "Sph0", Source = "Output", }, SceneInput2 = Input { SourceOp = "Cam0", Source = "Output", }, }, },
1697\t\tOp_0 = Renderer3D { Inputs = { Width = Input { Value = 512, }, Height = Input { Value = 512, }, SceneInput = Input { SourceOp = "M3D0", Source = "Output", }, }, },
1698
1699\t\t-- f01: Merge 256x256 FG onto 1024x512 BG at Size=0.6, then scaled to 512x512
1700\t\tM_1 = Merge { Inputs = { Background = Input { SourceOp = "Dark1024", Source = "Output", }, Foreground = Input { SourceOp = "White256", Source = "Output", }, Size = Input { Value = 0.6, }, }, },
1701\t\tOp_1 = BetterResize { Inputs = { Input = Input { SourceOp = "M_1", Source = "Output", }, Width = Input { Value = 512, }, Height = Input { Value = 512, }, }, },
1702
1703\t\t-- f02: Exact Noise_1 from 60_moon_guide_u (Detail=0.39, Contrast=0.23, Brightness=-0.4, Discontinuous=1, Type=1)
1704\t\tOp_2 = FastNoise {
1705\t\t\tInputs = {
1706\t\t\t\tWidth = Input { Value = 512, }, Height = Input { Value = 512, },
1707\t\t\t\tDetail = Input { Value = 0.39, },
1708\t\t\t\tContrast = Input { Value = 0.23, },
1709\t\t\t\tBrightness = Input { Value = -0.4, },
1710\t\t\t\tXScale = Input { Value = 28.1, },
1711\t\t\t\tYScale = Input { Value = 10, },
1712\t\t\t\tAngle = Input { Value = 114.8, },
1713\t\t\t\tDiscontinuous = Input { Value = 1, },
1714\t\t\t\tType = Input { Value = 1, },
1715\t\t\t\tColor1Alpha = Input { Value = 1, },
1716\t\t\t},
1717\t\t},""",
1718 ]
1719 splines = []
1720 prev = "BlackBG"
1721 for f, _label in cases:
1722 bl = {c[0]: (1.0 if c[0] == f else 0.0) for c in cases}
1723 sname = f"M3_{f}_Blend"
1724 splines.append(step_spline(sname, bl))
1725 nodes.append(f"""\t\tSw_{f} = Merge {{
1726\t\t\tInputs = {{
1727\t\t\t\tBlend = Input {{ SourceOp = "{sname}", Source = "Value", }},
1728\t\t\t\tBackground = Input {{ SourceOp = "{prev}", Source = "Output", }},
1729\t\t\t\tForeground = Input {{ SourceOp = "Op_{f}", Source = "Output", }},
1730\t\t\t}},
1731\t\t}},""")
1732 prev = f"Sw_{f}"
1733 nodes.append(make_saver(prev, "moon_3d"))
1734 comp_path = local_root() / "comps" / "probe_moon_3d.comp"
1735 comp_path.write_text(make_comp("\n".join(nodes + splines), len(cases) - 1))
1736 return comp_path, "moon_3d", cases
1737
1738
1739def generate_greenscreen_chart(w=512, h=512) -> str:
1740 """512x512 RGB ramp spanning typical green-screen shades, skin tones, grays, and primaries."""
1741 p = local_root() / "assets" / "greenscreen_chart.png"
1742 buf = bytearray(w * h * 4)
1743 for y in range(h):
1744 v = y / (h - 1)
1745 for x in range(w):
1746 u = x / (w - 1)
1747 if y < h // 2:
1748 # Top half: varied green-screen shades around (0.38, 0.58, 0.53) and (0.16, 0.72, 0.23)
1749 # u varies luminance/exposure, v varies greenness/saturation
1750 t = v * 2.0
1751 r = max(0.0, min(1.0, (0.05 + 0.55 * u) * (1.0 - 0.5 * (1.0 - t))))
1752 g = max(0.0, min(1.0, 0.25 + 0.65 * u + 0.15 * (1.0 - t)))
1753 b = max(0.0, min(1.0, (0.05 + 0.55 * u) * (0.3 + 0.7 * t)))
1754 else:
1755 # Bottom half: hue wheel + skin/neutral stripes
1756 t = (v - 0.5) * 2.0
1757 if t < 0.5:
1758 # Hue sweep at high sat
1759 h6 = u * 6.0
1760 c = 0.75
1761 x_c = c * (1.0 - abs((h6 % 2.0) - 1.0))
1762 m = 0.15
1763 if h6 < 1: r, g, b = c+m, x_c+m, m
1764 elif h6 < 2: r, g, b = x_c+m, c+m, m
1765 elif h6 < 3: r, g, b = m, c+m, x_c+m
1766 elif h6 < 4: r, g, b = m, x_c+m, c+m
1767 elif h6 < 5: r, g, b = x_c+m, m, c+m
1768 else: r, g, b = c+m, m, x_c+m
1769 else:
1770 # Skin tone to gray to teal gradient
1771 s = (t - 0.5) * 2.0
1772 r = 0.85 * (1.0 - u) + 0.25 * u
1773 g = 0.65 * (1.0 - u) + 0.58 * u
1774 b = 0.55 * (1.0 - u) + 0.53 * u
1775 r = r * (1.0 - 0.4 * s) + 0.4 * s
1776 g = g * (1.0 - 0.4 * s) + 0.4 * s
1777 b = b * (1.0 - 0.4 * s) + 0.4 * s
1778 idx = (y * w + x) * 4
1779 buf[idx] = int(round(max(0.0, min(1.0, r)) * 255))
1780 buf[idx + 1] = int(round(max(0.0, min(1.0, g)) * 255))
1781 buf[idx + 2] = int(round(max(0.0, min(1.0, b)) * 255))
1782 buf[idx + 3] = 255
1783 write_png_rgba(p, w, h, bytes(buf))
1784 return f"{CONTAINER_ROOT}/assets/greenscreen_chart.png"
1785
1786
1787def build_probe_ultrakey():
1788 """Shale #10 probe: UltraKeyer exact matte/threshold/range/PostMultiply/MatteBlur parity."""
1789 gs = generate_greenscreen_chart()
1790 cases = [
1791 (0, "uk_bg_only_pm1"),
1792 (1, "uk_bg_only_pm0_over_red"),
1793 (2, "uk_crazy_uk1_exact_over_red"),
1794 (3, "uk_crazy_uk2_exact_over_red"),
1795 (4, "uk_sep_0.2_spill_0.5"),
1796 (5, "uk_alpha_only_uk1"),
1797 (6, "uk_alpha_only_uk2"),
1798 ]
1799 nodes = [
1800 make_loader("GSLoader", gs, post_mult=1),
1801 """\t\tBlackBG = Background { Inputs = { Width = Input { Value = 512, }, Height = Input { Value = 512, }, TopLeftAlpha = Input { Value = 1, }, }, },
1802\t\tRedBG = Background { Inputs = { Width = Input { Value = 512, }, Height = Input { Value = 512, }, TopLeftRed = Input { Value = 0.9, }, TopLeftGreen = Input { Value = 0.1, }, TopLeftBlue = Input { Value = 0.1, }, TopLeftAlpha = Input { Value = 1, }, }, },
1803\t\t-- f00: basic green key, PostMultiply=1 (default)
1804\t\tOp_0 = UltraKeyer {
1805\t\t\tInputs = {
1806\t\t\t\tBackgroundRed = Input { Value = 0.383215, },
1807\t\t\t\tBackgroundGreen = Input { Value = 0.583642, },
1808\t\t\t\tBackgroundBlue = Input { Value = 0.530770, },
1809\t\t\t\tInput = Input { SourceOp = "GSLoader", Source = "Output", },
1810\t\t\t},
1811\t\t},
1812\t\t-- f01: basic green key, PostMultiply=0 merged over RedBG
1813\t\tUK_1 = UltraKeyer {
1814\t\t\tInputs = {
1815\t\t\t\tBackgroundRed = Input { Value = 0.383215, },
1816\t\t\t\tBackgroundGreen = Input { Value = 0.583642, },
1817\t\t\t\tBackgroundBlue = Input { Value = 0.530770, },
1818\t\t\t\tPostMultiplyImage = Input { Value = 0, },
1819\t\t\t\tInput = Input { SourceOp = "GSLoader", Source = "Output", },
1820\t\t\t},
1821\t\t},
1822\t\tOp_1 = Merge { Inputs = { Background = Input { SourceOp = "RedBG", Source = "Output", }, Foreground = Input { SourceOp = "UK_1", Source = "Output", }, }, },
1823\t\t-- f02: exact UltraKeyer1 from 30_ground_is_crazy001 merged over RedBG
1824\t\tUK_2 = UltraKeyer {
1825\t\t\tInputs = {
1826\t\t\t\tBackgroundRed = Input { Value = 0.383215069770813, },
1827\t\t\t\tBackgroundGreen = Input { Value = 0.583642303943634, },
1828\t\t\t\tBackgroundBlue = Input { Value = 0.530769824981689, },
1829\t\t\t\tRedLow = Input { Value = 0.400122076272964, },
1830\t\t\t\tRedHigh = Input { Value = 0.424994289875031, },
1831\t\t\t\tGreenLow = Input { Value = 0.534645617008209, },
1832\t\t\t\tGreenHigh = Input { Value = 0.552941203117371, },
1833\t\t\t\tBlueLow = Input { Value = 0.496787965297699, },
1834\t\t\t\tBlueHigh = Input { Value = 0.557503640651703, },
1835\t\t\t\tLuminanceLow = Input { Value = 0.338475614786148, },
1836\t\t\t\tLuminanceHigh = Input { Value = 0.566201269626617, },
1837\t\t\t\tPostMultiplyImage = Input { Value = 0, },
1838\t\t\t\tInput = Input { SourceOp = "GSLoader", Source = "Output", },
1839\t\t\t},
1840\t\t},
1841\t\tOp_2 = Merge { Inputs = { Background = Input { SourceOp = "RedBG", Source = "Output", }, Foreground = Input { SourceOp = "UK_2", Source = "Output", }, }, },
1842\t\t-- f03: exact UltraKeyer2 from 30_ground_is_crazy001 merged over RedBG
1843\t\tUK_3 = UltraKeyer {
1844\t\t\tInputs = {
1845\t\t\t\tBackgroundRed = Input { Value = 0.162176, },
1846\t\t\t\tBackgroundGreen = Input { Value = 0.724, },
1847\t\t\t\tBackgroundBlue = Input { Value = 0.225100288, },
1848\t\t\t\tRedLow = Input { Value = 0.414969086647034, },
1849\t\t\t\tRedHigh = Input { Value = 0.419638365507126, },
1850\t\t\t\tGreenLow = Input { Value = 0.546013593673706, },
1851\t\t\t\tGreenHigh = Input { Value = 0.547783613204956, },
1852\t\t\t\tBlueLow = Input { Value = 0.515922784805298, },
1853\t\t\t\tBlueHigh = Input { Value = 0.519722282886505, },
1854\t\t\t\tLuminanceLow = Input { Value = 0.439078360795975, },
1855\t\t\t\tLuminanceHigh = Input { Value = 0.440360099077225, },
1856\t\t\t\tFringeGamma = Input { Value = 0.861, },
1857\t\t\t\tFringeShape = Input { Value = 0.906, },
1858\t\t\t\tMatteBlur = Input { Value = 0.24, },
1859\t\t\t\tLowMatteThreshold = Input { Value = 0.706, },
1860\t\t\t\tHigh = Input { Value = 0.783, },
1861\t\t\t\tPostMultiplyImage = Input { Value = 0, },
1862\t\t\t\tInput = Input { SourceOp = "GSLoader", Source = "Output", },
1863\t\t\t},
1864\t\t},
1865\t\tOp_3 = Merge { Inputs = { Background = Input { SourceOp = "RedBG", Source = "Output", }, Foreground = Input { SourceOp = "UK_3", Source = "Output", }, }, },
1866\t\t-- f04: MatteSeparation + SpillSuppression
1867\t\tOp_4 = UltraKeyer {
1868\t\t\tInputs = {
1869\t\t\t\tBackgroundRed = Input { Value = 0.16, },
1870\t\t\t\tBackgroundGreen = Input { Value = 0.72, },
1871\t\t\t\tBackgroundBlue = Input { Value = 0.22, },
1872\t\t\t\tMatteSeparation = Input { Value = 0.2, },
1873\t\t\t\tSpillSuppression = Input { Value = 0.5, },
1874\t\t\t\tInput = Input { SourceOp = "GSLoader", Source = "Output", },
1875\t\t\t},
1876\t\t},
1877\t\t-- f05: Visualize alpha of UK_2 directly as grayscale RGB
1878\t\tOp_5 = ChannelBoolean {
1879\t\t\tInputs = {
1880\t\t\t\tToRed = Input { Value = 3, },
1881\t\t\t\tToGreen = Input { Value = 3, },
1882\t\t\t\tToBlue = Input { Value = 3, },
1883\t\t\t\tToAlpha = Input { Value = 16, },
1884\t\t\t\tBackground = Input { SourceOp = "UK_2", Source = "Output", },
1885\t\t\t},
1886\t\t},
1887\t\t-- f06: Visualize alpha of UK_3 directly as grayscale RGB
1888\t\tOp_6 = ChannelBoolean {
1889\t\t\tInputs = {
1890\t\t\t\tToRed = Input { Value = 3, },
1891\t\t\t\tToGreen = Input { Value = 3, },
1892\t\t\t\tToBlue = Input { Value = 3, },
1893\t\t\t\tToAlpha = Input { Value = 16, },
1894\t\t\t\tBackground = Input { SourceOp = "UK_3", Source = "Output", },
1895\t\t\t},
1896\t\t},""",
1897 ]
1898 splines = []
1899 prev = "BlackBG"
1900 for f, _label in cases:
1901 bl = {c[0]: (1.0 if c[0] == f else 0.0) for c in cases}
1902 sname = f"UK_{f}_Blend"
1903 splines.append(step_spline(sname, bl))
1904 nodes.append(f"""\t\tSw_{f} = Merge {{
1905\t\t\tInputs = {{
1906\t\t\t\tBlend = Input {{ SourceOp = "{sname}", Source = "Value", }},
1907\t\t\t\tBackground = Input {{ SourceOp = "{prev}", Source = "Output", }},
1908\t\t\t\tForeground = Input {{ SourceOp = "Op_{f}", Source = "Output", }},
1909\t\t\t}},
1910\t\t}},""")
1911 prev = f"Sw_{f}"
1912 nodes.append(make_saver(prev, "ultrakey"))
1913 comp_path = local_root() / "comps" / "probe_ultrakey.comp"
1914 comp_path.write_text(make_comp("\n".join(nodes + splines), len(cases) - 1))
1915 return comp_path, "ultrakey", cases
1916
1917
1918def build_probe_archive_3d():
1919 """Shale #11 probe: 3D lights/materials/modifiers/Text3D + WandMask + Fuse.Duplicate + Fuse.KScope."""
1920 grid = generate_grid_chart()
1921 cases = [
1922 (0, "light_point_mtl_blinn"),
1923 (1, "light_spot_mtl_cook"),
1924 (2, "replace_mtl_tex2d"),
1925 (3, "override3d_hide_cube"),
1926 (4, "duplicate3d_5x"),
1927 (5, "displace3d_plane"),
1928 (6, "text3d_hello"),
1929 (7, "wand_mask_red_quad"),
1930 (8, "fuse_duplicate_4x"),
1931 ]
1932 nodes = [
1933 make_loader("GridLoader", grid, post_mult=1),
1934 """\t\tBlackBG = Background { Inputs = { Width = Input { Value = 512, }, Height = Input { Value = 512, }, TopLeftAlpha = Input { Value = 1, }, }, },
1935\t\tGradBG = Background { Inputs = { Width = Input { Value = 256, }, Height = Input { Value = 256, }, Type = Input { Value = FuID { "Horizontal" }, }, TopLeftRed = Input { Value = 0, }, TopLeftGreen = Input { Value = 0, }, TopLeftBlue = Input { Value = 0, }, TopRightRed = Input { Value = 1, }, TopRightGreen = Input { Value = 1, }, TopRightBlue = Input { Value = 1, }, TopLeftAlpha = Input { Value = 1, }, }, },
1936\t\tCamBase = Camera3D { Inputs = { ["Transform3DOp.Translate.Z"] = Input { Value = 5.0, }, AoV = Input { Value = 35.0, }, FilmGate = Input { Value = FuID { "User" }, }, ApertureW = Input { Value = 1.0, }, ApertureH = Input { Value = 1.0, }, }, },
1937\t\t-- f00: LightPoint + MtlBlinn on Sphere
1938\t\tBlinn0 = MtlBlinn { Inputs = { ["Diffuse.Color.Red"] = Input { Value = 0.2, }, ["Diffuse.Color.Green"] = Input { Value = 0.6, }, ["Diffuse.Color.Blue"] = Input { Value = 0.9, }, ["Specular.Intensity"] = Input { Value = 0.8, }, ["Specular.Exponent"] = Input { Value = 32.0, }, }, },
1939\t\tSph0 = Shape3D { Inputs = { Shape = Input { Value = FuID { "SurfaceSphereInputs" }, }, MaterialInput = Input { SourceOp = "Blinn0", Source = "MaterialOutput", }, }, },
1940\t\tPt0 = LightPoint { Inputs = { ["Transform3DOp.Translate.X"] = Input { Value = 2.0, }, ["Transform3DOp.Translate.Y"] = Input { Value = 1.5, }, ["Transform3DOp.Translate.Z"] = Input { Value = 3.0, }, Intensity = Input { Value = 1.2, }, }, },
1941\t\tAmb0 = LightAmbient { Inputs = { Intensity = Input { Value = 0.15, }, }, },
1942\t\tM3D_0 = Merge3D { Inputs = { SceneInput1 = Input { SourceOp = "Sph0", Source = "Output", }, SceneInput2 = Input { SourceOp = "Pt0", Source = "Output", }, SceneInput3 = Input { SourceOp = "Amb0", Source = "Output", }, SceneInput4 = Input { SourceOp = "CamBase", Source = "Output", }, }, },
1943\t\tOp_0 = Renderer3D { Inputs = { Width = Input { Value = 512, }, Height = Input { Value = 512, }, ["RendererSoftware.LightingEnabled"] = Input { Value = 1, }, SceneInput = Input { SourceOp = "M3D_0", Source = "Output", }, }, },
1944\t\t-- f01: LightSpot + MtlCookTorrance on Plane
1945\t\tCook1 = MtlCookTorrance { Inputs = { ["Diffuse.Color.Red"] = Input { Value = 0.9, }, ["Diffuse.Color.Green"] = Input { Value = 0.8, }, ["Diffuse.Color.Blue"] = Input { Value = 0.7, }, ["Specular.Roughness"] = Input { Value = 0.35, }, }, },
1946\t\tPl1 = Shape3D { Inputs = { Shape = Input { Value = FuID { "SurfacePlaneInputs" }, }, ["SurfacePlaneInputs.Width"] = Input { Value = 3.0, }, ["SurfacePlaneInputs.Height"] = Input { Value = 3.0, }, MaterialInput = Input { SourceOp = "Cook1", Source = "MaterialOutput", }, }, },
1947\t\tSpot1 = LightSpot { Inputs = { ["Transform3DOp.Translate.Z"] = Input { Value = 3.5, }, ConeAngle = Input { Value = 30.0, }, PenumbraAngle = Input { Value = 10.0, }, Intensity = Input { Value = 1.2, }, }, },
1948\t\tM3D_1 = Merge3D { Inputs = { SceneInput1 = Input { SourceOp = "Pl1", Source = "Output", }, SceneInput2 = Input { SourceOp = "Spot1", Source = "Output", }, SceneInput3 = Input { SourceOp = "CamBase", Source = "Output", }, }, },
1949\t\tOp_1 = Renderer3D { Inputs = { Width = Input { Value = 512, }, Height = Input { Value = 512, }, ["RendererSoftware.LightingEnabled"] = Input { Value = 1, }, SceneInput = Input { SourceOp = "M3D_1", Source = "Output", }, }, },
1950\t\t-- f02: ReplaceMaterial3D + Texture2DOperator
1951\t\tTex2 = Texture2DOperator { Inputs = { Input = Input { SourceOp = "GridLoader", Source = "Output", }, }, },
1952\t\tSph2 = Shape3D { Inputs = { Shape = Input { Value = FuID { "SurfaceSphereInputs" }, }, }, },
1953\t\tRep2 = ReplaceMaterial3D { Inputs = { SceneInput = Input { SourceOp = "Sph2", Source = "Output", }, MaterialInput = Input { SourceOp = "Tex2", Source = "MaterialOutput", }, }, },
1954\t\tM3D_2 = Merge3D { Inputs = { SceneInput1 = Input { SourceOp = "Rep2", Source = "Output", }, SceneInput2 = Input { SourceOp = "CamBase", Source = "Output", }, }, },
1955\t\tOp_2 = Renderer3D { Inputs = { Width = Input { Value = 512, }, Height = Input { Value = 512, }, SceneInput = Input { SourceOp = "M3D_2", Source = "Output", }, }, },
1956\t\t-- f03: Override3D hiding left cube while right cube remains visible
1957\t\tCubeL = Shape3D { Inputs = { Shape = Input { Value = FuID { "SurfaceCubeInputs" }, }, ["Transform3DOp.Translate.X"] = Input { Value = -0.8, }, ["MtlStdInputs.Diffuse.Color.Red"] = Input { Value = 1.0, }, ["MtlStdInputs.Diffuse.Color.Green"] = Input { Value = 0.2, }, ["MtlStdInputs.Diffuse.Color.Blue"] = Input { Value = 0.2, }, }, },
1958\t\tOvr3 = Override3D { Inputs = { SceneInput = Input { SourceOp = "CubeL", Source = "Output", }, ["Visibility.DoVisible"] = Input { Value = 1, }, ["Visibility.IsVisible"] = Input { Value = 0, }, }, },
1959\t\tCubeR = Shape3D { Inputs = { Shape = Input { Value = FuID { "SurfaceCubeInputs" }, }, ["Transform3DOp.Translate.X"] = Input { Value = 0.8, }, ["MtlStdInputs.Diffuse.Color.Red"] = Input { Value = 0.2, }, ["MtlStdInputs.Diffuse.Color.Green"] = Input { Value = 0.8, }, ["MtlStdInputs.Diffuse.Color.Blue"] = Input { Value = 0.3, }, }, },
1960\t\tM3D_3 = Merge3D { Inputs = { SceneInput1 = Input { SourceOp = "Ovr3", Source = "Output", }, SceneInput2 = Input { SourceOp = "CubeR", Source = "Output", }, SceneInput3 = Input { SourceOp = "CamBase", Source = "Output", }, }, },
1961\t\tOp_3 = Renderer3D { Inputs = { Width = Input { Value = 512, }, Height = Input { Value = 512, }, SceneInput = Input { SourceOp = "M3D_3", Source = "Output", }, }, },
1962\t\t-- f04: Duplicate3D 5 copies along X
1963\t\tBox4 = Shape3D { Inputs = { Shape = Input { Value = FuID { "SurfaceCubeInputs" }, }, ["SurfaceCubeInputs.Size"] = Input { Value = 0.35, }, ["Transform3DOp.Translate.X"] = Input { Value = -1.2, }, ["MtlStdInputs.Diffuse.Color.Red"] = Input { Value = 0.9, }, ["MtlStdInputs.Diffuse.Color.Green"] = Input { Value = 0.5, }, ["MtlStdInputs.Diffuse.Color.Blue"] = Input { Value = 0.1, }, }, },
1964\t\tDup4 = Duplicate3D { Inputs = { SceneInput = Input { SourceOp = "Box4", Source = "Output", }, FirstCopy = Input { Value = 0, }, LastCopy = Input { Value = 4, }, ["Translate.X"] = Input { Value = 0.6, }, ["Rotate.Z"] = Input { Value = 15.0, }, }, },
1965\t\tM3D_4 = Merge3D { Inputs = { SceneInput1 = Input { SourceOp = "Dup4", Source = "Output", }, SceneInput2 = Input { SourceOp = "CamBase", Source = "Output", }, }, },
1966\t\tOp_4 = Renderer3D { Inputs = { Width = Input { Value = 512, }, Height = Input { Value = 512, }, SceneInput = Input { SourceOp = "M3D_4", Source = "Output", }, }, },
1967\t\t-- f05: Displace3D on subdivided plane
1968\t\tPl5 = Shape3D { Inputs = { Shape = Input { Value = FuID { "SurfacePlaneInputs" }, }, ["SurfacePlaneInputs.Width"] = Input { Value = 2.0, }, ["SurfacePlaneInputs.Height"] = Input { Value = 2.0, }, ["Transform3DOp.Rotate.Y"] = Input { Value = -35.0, }, MaterialInput = Input { SourceOp = "GridLoader", Source = "Output", }, }, },
1969\t\tDisp5 = Displace3D { Inputs = { SceneInput = Input { SourceOp = "Pl5", Source = "Output", }, Input = Input { SourceOp = "GradBG", Source = "Output", }, Scale = Input { Value = 0.5, }, }, },
1970\t\tM3D_5 = Merge3D { Inputs = { SceneInput1 = Input { SourceOp = "Disp5", Source = "Output", }, SceneInput2 = Input { SourceOp = "CamBase", Source = "Output", }, }, },
1971\t\tOp_5 = Renderer3D { Inputs = { Width = Input { Value = 512, }, Height = Input { Value = 512, }, SceneInput = Input { SourceOp = "M3D_5", Source = "Output", }, }, },
1972\t\t-- f06: Text3D
1973\t\tT3D_6 = Text3D { Inputs = { StyledText = Input { Value = "HELLO", }, Font = Input { Value = "Open Sans", }, Style = Input { Value = "Bold", }, Size = Input { Value = 0.35, }, Red1 = Input { Value = 1.0, }, Green1 = Input { Value = 0.85, }, Blue1 = Input { Value = 0.2, }, }, },
1974\t\tM3D_6 = Merge3D { Inputs = { SceneInput1 = Input { SourceOp = "T3D_6", Source = "Output", }, SceneInput2 = Input { SourceOp = "CamBase", Source = "Output", }, }, },
1975\t\tOp_6 = Renderer3D { Inputs = { Width = Input { Value = 512, }, Height = Input { Value = 512, }, SceneInput = Input { SourceOp = "M3D_6", Source = "Output", }, }, },
1976\t\t-- f07: WandMask selecting top-left red cell of GridLoader
1977\t\tWand7 = WandMask { Inputs = { Source = Input { SourceOp = "GridLoader", Source = "Output", }, SelectionPoint = Input { Value = { 0.08, 0.92 }, }, SelectionRange = Input { Value = 0.15, }, }, },
1978\t\tOp_7 = Background { Inputs = { Width = Input { Value = 512, }, Height = Input { Value = 512, }, TopLeftRed = Input { Value = 1, }, TopLeftGreen = Input { Value = 1, }, TopLeftBlue = Input { Value = 1, }, TopLeftAlpha = Input { Value = 1, }, EffectMask = Input { SourceOp = "Wand7", Source = "Mask", }, }, },
1979\t\t-- f08: Fuse.Duplicate 4 copies rotated 30 deg & scaled 0.85
1980\t\tSmall8 = Transform { Inputs = { Input = Input { SourceOp = "GridLoader", Source = "Output", }, Size = Input { Value = 0.45, }, }, },
1981\t\tOp_8 = Fuse.Duplicate { Inputs = { Background = Input { SourceOp = "Small8", Source = "Output", }, Copies = Input { Value = 4, }, Angle = Input { Value = 30.0, }, XSize = Input { Value = 0.85, }, }, },""",
1982 ]
1983 splines = []
1984 prev = "BlackBG"
1985 for f, _label in cases:
1986 bl = {c[0]: (1.0 if c[0] == f else 0.0) for c in cases}
1987 sname = f"A3D_{f}_Blend"
1988 splines.append(step_spline(sname, bl))
1989 nodes.append(f"""\t\tSw_{f} = Merge {{
1990\t\t\tInputs = {{
1991\t\t\t\tBlend = Input {{ SourceOp = "{sname}", Source = "Value", }},
1992\t\t\t\tBackground = Input {{ SourceOp = "{prev}", Source = "Output", }},
1993\t\t\t\tForeground = Input {{ SourceOp = "Op_{f}", Source = "Output", }},
1994\t\t\t}},
1995\t\t}},""")
1996 prev = f"Sw_{f}"
1997 nodes.append(make_saver(prev, "archive_3d"))
1998 comp_path = local_root() / "comps" / "probe_archive_3d.comp"
1999 comp_path.write_text(make_comp("\n".join(nodes + splines), len(cases) - 1))
2000 return comp_path, "archive_3d", cases
2001
2002
2003def build_probe_custom_tool():
2004 """Shale #18 probe: CustomTool per-pixel DSL (waves, premul invert, samplers, if, LUTIn1, Setup/Inter, mask/blend) + Expression modifier."""
2005 chart = generate_color_chart()
2006 grid = generate_grid_chart()
2007 cases = [
2008 (0, "custom_wave_sin_deg"),
2009 (1, "custom_premul_invert_i1"),
2010 (2, "custom_samplers_b_w_d"),
2011 (3, "custom_if_img2_pt_num"),
2012 (4, "custom_lut1_curve"),
2013 (5, "custom_setup_c1_mod_dist"),
2014 (6, "custom_mask_blend_procb0"),
2015 (7, "expression_modifier_num_pt"),
2016 ]
2017 nodes = [
2018 make_loader("ChartLoader", chart, post_mult=1),
2019 make_loader("GridLoader", grid, post_mult=1),
2020 """\t\tBlackBG = Background { Inputs = { Width = Input { Value = 512, }, Height = Input { Value = 512, }, TopLeftAlpha = Input { Value = 1, }, }, },
2021\t\t-- f00: sin/cos wave generator matching 20_falling CustomTool1
2022\t\tOp_0 = Custom {
2023\t\t\tInputs = {
2024\t\t\t\tImage1 = Input { SourceOp = "ChartLoader", Source = "Output", },
2025\t\t\t\tNumberIn1 = Input { Value = 0.7413, },
2026\t\t\t\tNumberIn2 = Input { Value = 10.655, },
2027\t\t\t\tRedExpression = Input { Value = "sin(x*w*n1 + n2*n1*w)*0.5+0.5", },
2028\t\t\t\tGreenExpression = Input { Value = "sin(y*w*n1 + n2*n1*w)*0.5+0.5", },
2029\t\t\t\tBlueExpression = Input { Value = "0\\n", },
2030\t\t\t\tAlphaExpression = Input { Value = "1", },
2031\t\t\t},
2032\t\t},
2033\t\t-- f01: Premul/unpremul invert via Intermediate1 matching CustomTool2
2034\t\tOp_1 = Custom {
2035\t\t\tInputs = {
2036\t\t\t\tImage1 = Input { SourceOp = "ChartLoader", Source = "Output", },
2037\t\t\t\tIntermediate1 = Input { Value = "a1", },
2038\t\t\t\tRedExpression = Input { Value = "(1-r1/a1)*i1", },
2039\t\t\t\tGreenExpression = Input { Value = "(1-g1/a1)*i1", },
2040\t\t\t\tBlueExpression = Input { Value = "(1-b1/a1)*i1", },
2041\t\t\t\tAlphaExpression = Input { Value = "i1", },
2042\t\t\t},
2043\t\t},
2044\t\t-- f02: Offset image samplers (b=black, w=wrap, d=duplicate)
2045\t\tOp_2 = Custom {
2046\t\t\tInputs = {
2047\t\t\t\tImage1 = Input { SourceOp = "GridLoader", Source = "Output", },
2048\t\t\t\tRedExpression = Input { Value = "getr1b(x + 0.15, y - 0.1)", },
2049\t\t\t\tGreenExpression = Input { Value = "getg1w(x + 0.25, y + 0.25)", },
2050\t\t\t\tBlueExpression = Input { Value = "getb1d(x - 0.2, y + 0.2)", },
2051\t\t\t\tAlphaExpression = Input { Value = "1", },
2052\t\t\t},
2053\t\t},
2054\t\t-- f03: if(...), Image2, PointIn1, NumberIn1
2055\t\tOp_3 = Custom {
2056\t\t\tInputs = {
2057\t\t\t\tImage1 = Input { SourceOp = "ChartLoader", Source = "Output", },
2058\t\t\t\tImage2 = Input { SourceOp = "GridLoader", Source = "Output", },
2059\t\t\t\tNumberIn1 = Input { Value = 0.6, },
2060\t\t\t\tPointIn1 = Input { Value = { 0.4, 0.6 }, },
2061\t\t\t\tRedExpression = Input { Value = "if(x > p1x, r1 * n1, r2)", },
2062\t\t\t\tGreenExpression = Input { Value = "if(y > p1y, g1, g2 * n1)", },
2063\t\t\t\tBlueExpression = Input { Value = "if(x > p1x && y > p1y, b2, b1)", },
2064\t\t\t\tAlphaExpression = Input { Value = "1", },
2065\t\t\t},
2066\t\t},
2067\t\t-- f04: LUTIn1 curved spline
2068\t\tOp_4LUTIn1 = LUTBezier {
2069\t\t\tKeyColorSplines = {
2070\t\t\t\t[0] = {
2071\t\t\t\t\t[0] = { 0.0, RH = { 0.15, 0.6 }, },
2072\t\t\t\t\t[0.5] = { 0.85, LH = { 0.35, 0.85 }, RH = { 0.65, 0.85 }, },
2073\t\t\t\t\t[1] = { 0.2, LH = { 0.85, 0.4 }, },
2074\t\t\t\t},
2075\t\t\t},
2076\t\t},
2077\t\tOp_4 = Custom {
2078\t\t\tInputs = {
2079\t\t\t\tImage1 = Input { SourceOp = "ChartLoader", Source = "Output", },
2080\t\t\t\tLUTIn1 = Input { SourceOp = "Op_4LUTIn1", Source = "Value", },
2081\t\t\t\tRedExpression = Input { Value = "getlut1(r1)", },
2082\t\t\t\tGreenExpression = Input { Value = "getlut1(g1)", },
2083\t\t\t\tBlueExpression = Input { Value = "getlut1(b1)", },
2084\t\t\t\tAlphaExpression = Input { Value = "a1", },
2085\t\t\t},
2086\t\t},
2087\t\t-- f05: Setup1/2, Intermediate1, c1, e^-(), %, dist, max(3)
2088\t\tOp_5 = Custom {
2089\t\t\tInputs = {
2090\t\t\t\tImage1 = Input { SourceOp = "ChartLoader", Source = "Output", },
2091\t\t\t\tNumberIn1 = Input { Value = 0.4, },
2092\t\t\t\tNumberIn2 = Input { Value = 0.2, },
2093\t\t\t\tSetup1 = Input { Value = "1 - n1", },
2094\t\t\t\tIntermediate1 = Input { Value = "max(0, 1 - dist(x, y, 0.5, 0.5) * 2)", },
2095\t\t\t\tRedExpression = Input { Value = "if(c1>n1, n1+s1*(1-e^-((c1-n1)/s1)), c1) * i1", },
2096\t\t\t\tGreenExpression = Input { Value = "((x * 4) % 1) * i1", },
2097\t\t\t\tBlueExpression = Input { Value = "max(r1, g1, b1) * i1", },
2098\t\t\t\tAlphaExpression = Input { Value = "1", },
2099\t\t\t},
2100\t\t},
2101\t\t-- f06: EffectMask + Blend=0.75 + ProcessBlue=0
2102\t\tMask6 = EllipseMask { Inputs = { MaskWidth = Input { Value = 512, }, MaskHeight = Input { Value = 512, }, Width = Input { Value = 0.65, }, Height = Input { Value = 0.65, }, }, },
2103\t\tOp_6 = Custom {
2104\t\t\tInputs = {
2105\t\t\t\tEffectMask = Input { SourceOp = "Mask6", Source = "Mask", },
2106\t\t\t\tBlend = Input { Value = 0.75, },
2107\t\t\t\tProcessBlue = Input { Value = 0, },
2108\t\t\t\tImage1 = Input { SourceOp = "GridLoader", Source = "Output", },
2109\t\t\t\tRedExpression = Input { Value = "1 - r1", },
2110\t\t\t\tGreenExpression = Input { Value = "1 - g1", },
2111\t\t\t\tBlueExpression = Input { Value = "0", },
2112\t\t\t\tAlphaExpression = Input { Value = "a1", },
2113\t\t\t},
2114\t\t},
2115\t\t-- f07: Standalone Expression modifier driving CustomTool NumberIn1 & Transform Center
2116\t\tExprNum7 = Expression {
2117\t\t\tInputs = {
2118\t\t\t\tn1 = Input { Value = 1.0, },
2119\t\t\t\tNumberExpression = Input { Value = "if(n1>0.5, sin(90)*0.5 + 0.25, 0.1)", },
2120\t\t\t},
2121\t\t},
2122\t\tExprPt7 = Expression {
2123\t\t\tInputs = {
2124\t\t\t\tp1 = Input { Value = { 0.8, 0.2 }, },
2125\t\t\t\tPointExpressionX = Input { Value = "0.5 + (p1x - 0.5) * 0.5", },
2126\t\t\t\tPointExpressionY = Input { Value = "0.6", },
2127\t\t\t},
2128\t\t},
2129\t\tXf7 = Transform {
2130\t\t\tInputs = {
2131\t\t\t\tInput = Input { SourceOp = "GridLoader", Source = "Output", },
2132\t\t\t\tCenter = Input { SourceOp = "ExprPt7", Source = "PointResult", },
2133\t\t\t\tSize = Input { Value = 0.7, },
2134\t\t\t},
2135\t\t},
2136\t\tOp_7 = Custom {
2137\t\t\tInputs = {
2138\t\t\t\tImage1 = Input { SourceOp = "Xf7", Source = "Output", },
2139\t\t\t\tNumberIn1 = Input { SourceOp = "ExprNum7", Source = "NumberResult", },
2140\t\t\t\tRedExpression = Input { Value = "r1 * n1", },
2141\t\t\t\tGreenExpression = Input { Value = "g1 * n1", },
2142\t\t\t\tBlueExpression = Input { Value = "b1", },
2143\t\t\t\tAlphaExpression = Input { Value = "a1", },
2144\t\t\t},
2145\t\t},""",
2146 ]
2147 splines = []
2148 prev = "BlackBG"
2149 for f, _label in cases:
2150 bl = {c[0]: (1.0 if c[0] == f else 0.0) for c in cases}
2151 sname = f"CT_{f}_Blend"
2152 splines.append(step_spline(sname, bl))
2153 nodes.append(f"""\t\tSw_{f} = Merge {{
2154\t\t\tInputs = {{
2155\t\t\t\tBlend = Input {{ SourceOp = "{sname}", Source = "Value", }},
2156\t\t\t\tBackground = Input {{ SourceOp = "{prev}", Source = "Output", }},
2157\t\t\t\tForeground = Input {{ SourceOp = "Op_{f}", Source = "Output", }},
2158\t\t\t}},
2159\t\t}},""")
2160 prev = f"Sw_{f}"
2161 nodes.append(make_saver(prev, "custom_tool"))
2162 comp_path = local_root() / "comps" / "probe_custom_tool.comp"
2163 comp_path.write_text(make_comp("\n".join(nodes + splines), len(cases) - 1))
2164 return comp_path, "custom_tool", cases
2165
2166
2167def main():
2168 ensure_dirs()
2169 which = [a for a in sys.argv[1:] if not a.startswith("--")] or ["merge"]
2170 skip_gt = "--no-gt" in sys.argv
2171 builders = {
2172 "merge": build_probe_merge,
2173 "cam3d": build_probe_cam3d,
2174 "cam3d_fov": build_probe_cam3d_fov,
2175 "mask": build_probe_mask,
2176 "mask_softedge": build_probe_mask_softedge,
2177 "xf": build_probe_transform,
2178 "blur": build_probe_blur,
2179 "color_ops": build_probe_color_ops,
2180 "displace": build_probe_displace,
2181 "displace_wave": build_probe_displace_wave,
2182 "vortex_cc": build_probe_vortex_cc,
2183 "moon_3d": build_probe_moon_3d,
2184 "ultrakey": build_probe_ultrakey,
2185 "archive_3d": build_probe_archive_3d,
2186 "custom_tool": build_probe_custom_tool,
2187 "glow": build_probe_glow,
2188 "text": build_probe_text,
2189 "noise_text": build_probe_noise_text,
2190 "tier1_a": build_probe_tier1_a,
2191 "tier1_b": build_probe_tier1_b,
2192 "tier1_c": build_probe_tier1_c,
2193 "tier1_d": build_probe_tier1_d,
2194 }
2195 for w in which:
2196 comp_path, prefix, cases = builders[w]()
2197 run_probe(comp_path, prefix, cases, render_gt=not skip_gt)
2198
2199
2200if __name__ == "__main__":
2201 main()