authoravatarclover caruso<git@paperclover.net>2026-12-01 06:32:24-08:00
committeravatarclover caruso<git@paperclover.net>2026-12-01 07:51:10-08:00
logff3b042e8b85c1ac22c08ea2ee5bbaa273413d43
treee199d0555d4090f0fcebb802929c2cb8f9c87c76
parent0e3fbd415f84bebe09f6c225478618f97a26f984
signature Signed by SSH key SHA256:52mNGHRsVFBDED9IAX5pe+LRWUefqTbxEReunq21QvU

fuzz_node: wire 3D scene, material, particle and time rigs

Adds per-tool harnesses so 32 more catalog tools fuzz against Fusion 21.1: scene (17), material (6), particle (9), time (2). SurfaceFBXMesh stays skipped (needs a mesh file). Assisted-by: claude-sonnet-5.5

1 files changed, 150 insertions(+), 16 deletions(-)

scripts/fuzz_node.py+150-16
......@@ -29,7 +29,7 @@ SCRIPTS = Path(__file__).resolve().parent
2929sys.path.insert(0, str(SCRIPTS))
3030
3131import diff_fuzz.assets as assets # noqa: E402
32from diff_fuzz.assets import CONTAINER_ROOT, generate_assets, make_comp, make_loader, make_saver, step_spline # noqa: E402
32from diff_fuzz.assets import CONTAINER_ROOT, generate_assets, linear_spline, make_comp, make_loader, make_saver, step_spline # noqa: E402
3333from diff_fuzz.runner import alpha_mae_pct, run_comp_both # noqa: E402
3434from gen_compatibility import TOOL_METADATA # noqa: E402
3535
......@@ -43,6 +43,11 @@ SIZE = 256
4343FRAME_TIMEOUT = 20
4444GOLDEN = 0.6180339887498949
4545
46
47class FuID(str):
48 pass
49
50
4651# Tools the generic wiring cannot drive yet, with the reason recorded in the ledger.
4752UNSUPPORTED_RIG = {
4853 "Loader": "needs a footage clip; every probe already exercises it",
......@@ -59,14 +64,18 @@ UNSUPPORTED_RIG = {
5964 "PolylineStroke": "needs painted strokes",
6065 "Multistroke": "needs painted strokes",
6166 "PaintMask": "needs painted strokes",
62 "TimeSpeed": "time remap of a still plate is an identity",
63 "TimeStretcher": "time remap of a still plate is an identity",
67 "SurfaceFBXMesh": "needs a mesh file",
6468 "GridWarp": "needs mesh-point data",
6569}
66UNSUPPORTED_DOMAINS = {
67 "DataType3D": "3D scene rig not wired",
68 "MtlGraph3D": "3D material rig not wired",
69 "Particles": "particle rig not wired",
70UNRIGGED_DOMAINS = ("DataType3D", "MtlGraph3D", "Particles")
71RIGS = {
72 "scene": {
73 "Camera3D", "Cube3D", "Displace3D", "Duplicate3D", "ImagePlane3D", "LightAmbient", "LightDirectional", "LightPoint",
74 "LightSpot", "Merge3D", "Override3D", "Renderer3D", "ReplaceMaterial3D", "ReplaceNormals3D", "Shape3D", "Text3D", "Transform3D",
75 },
76 "material": {"MtlBlinn", "MtlPhong", "MtlCookTorrance", "BumpMap", "Texture2DOperator", "TextureTransformOperator"},
77 "particle": {"pEmitter", "pRender", "pMerge", "pDirectionalForce", "pDrag", "pTurbulence", "pPointForce", "pBounce", "pKill"},
78 "time": {"TimeSpeed", "TimeStretcher"},
7079}
7180
7281SLIDER_CONTROLS = {
......@@ -74,23 +83,40 @@ SLIDER_CONTROLS = {
7483 "ColorWheelControl", "ColorSuppressionControl", None,
7584}
7685CHOICE_CONTROLS = {"CheckboxControl", "MultiButtonControl", "MultiButtonIDControl", "ComboControl", "ComboIDControl"}
77# Inputs whose variation tests plumbing the engine intentionally lacks, or that resize the frame.
86# Inputs whose variation tests plumbing the engine intentionally lacks, that resize the frame, or that need
87# data the rigs lack (Renderer3D deep output, Displace3D camera, TimeSpeed/TimeStretcher optical flow: Fusion fails the frame).
7888DENY_IDS = {
7989 "MotionBlur", "ShutterAngle", "CenterBias", "SampleSpread", "UseGPU", "HideInputs", "HiQOnly",
8090 "Width", "Height", "PixelAspect", "Depth", "UseFrameFormatSettings", "AutoResolution", "ProcessMode",
8191 "UseObject", "UseMaterial", "ObjectID", "MaterialID", "CorrectEdges", "ProxyScale", "MaskWidth", "MaskHeight",
92 "RendererType", "OutputType", "PointCamera", "InterpolateBetweenFrames",
8293}
83DENY_PREFIXES = ("Gamut.", "ProcessLayers", "Comments", "Layer", "Motion", "Reset", "Stereo")
94# TimeSpeed fails the frame in Fusion once a reversed Speed reaches ~-24 frames of source time.
95INPUT_RANGES = {("TimeSpeed", "Speed"): (-2.0, 3.0)}
96DENY_PREFIXES = ("Gamut.", "ProcessLayers", "Comments", "Layer", "Motion", "Reset", "Stereo", "EnableWarp.")
8497DENY_SUFFIXES = ("_LayerSelect", "Nest", "Notify")
8598MASK_IDS = ("ApplyMaskInverted", "MultiplyByMask", "FitMask", "MaskChannel", "MaskLow", "MaskHigh", "MaskClipBlack", "MaskClipWhite")
8699IMAGE_INPUT_IDS = ("Input", "Background", "Foreground", "Image", "Source", "Image1", "Image2", "Image3", "BlurImage")
100# Renderer3D pinned to OpenGL: the catalog only lists RendererSoftware.* inputs, whose lighting toggles are remapped in `rig_frame`.
101RENDERER3D = {
102 "Width": SIZE, "Height": SIZE, "RendererType": FuID("RendererOpenGL"),
103 "RendererOpenGL.LightingEnabled": 1, "RendererOpenGL.ShadowsEnabled": 1,
104}
105EMITTER = {"RandomSeed": 42, "Style": FuID("ParticleStyleBlob"), "Number": 20, "Velocity": 0.05}
106PRENDER = {"OutputMode": FuID("TwoD"), "Width": SIZE, "Height": SIZE}
87107TOOL_OVERRIDES: Dict[str, Dict[str, Any]] = {
88108 "TextPlus": {"StyledText": "Fission", "Size": 0.12},
109 "Text3D": {"StyledText": "FISSION", "Font": "Open Sans", "Size": 0.25},
110 "Renderer3D": RENDERER3D,
111 "Camera3D": {"Transform3DOp.Translate.Z": 3.0},
112 "LightPoint": {"Transform3DOp.Translate.X": 1.2, "Transform3DOp.Translate.Y": 2.0, "Transform3DOp.Translate.Z": 2.0},
113 "LightSpot": {"Transform3DOp.Translate.Y": 2.0, "Transform3DOp.Translate.Z": 3.0, "Transform3DOp.Rotate.X": -35.0},
114 "LightDirectional": {"Transform3DOp.Rotate.X": -40.0, "Transform3DOp.Rotate.Y": 25.0},
115 "pEmitter": EMITTER,
116 "pRender": PRENDER,
89117}
90
91
92class FuID(str):
93 pass
118# Image-slot a texture plugs into on tools that otherwise render untextured.
119TEXTURE_SLOT = {"Shape3D": "MaterialInput", "ImagePlane3D": "MaterialInput", "Cube3D": "FrontMaterialInput"}
94120
95121
96122def lua_key(name: str) -> str:
......@@ -157,13 +183,13 @@ class Fuzzer:
157183 self.out_id = self.spec["outputs"][0]["id"] if self.spec["outputs"] else "Output"
158184 self.wired_images = [i for i in IMAGE_INPUT_IDS if self.inputs.get(i, {}).get("data_type") == "Image"]
159185 self.shape_inputs = [i["id"] for i in self.spec["inputs"] if i.get("data_type") == "ShapeTree"]
186 self.rig = next((r for r, tools_ in RIGS.items() if tool in tools_), None)
160187
161188 def skip_reason(self) -> Optional[str]:
162189 if self.tool in UNSUPPORTED_RIG:
163190 return UNSUPPORTED_RIG[self.tool]
164 for dom, why in UNSUPPORTED_DOMAINS.items():
165 if self.out_type == dom or any(i.get("data_type") == dom for i in self.spec["inputs"]):
166 return why
191 if self.rig is None and any(d in {self.out_type, *self.in_types} for d in UNRIGGED_DOMAINS):
192 return "no 3D/material/particle rig for this tool"
167193 return None
168194
169195 # ---- variation sampling -------------------------------------------------------------
......@@ -200,6 +226,7 @@ class Fuzzer:
200226 return alt[int(u * len(alt)) % len(alt)] if alt else default
201227 lo = max(i["min_scale"], i.get("min_allowed", -1e6))
202228 hi = min(i["max_scale"], i.get("max_allowed", 1e6))
229 lo, hi = INPUT_RANGES.get((self.tool, i["id"]), (lo, hi))
203230 v = lo + u * (hi - lo)
204231 return int(round(v)) if i.get("integer") else round(v, 5)
205232
......@@ -246,6 +273,104 @@ class Fuzzer:
246273 fixed[dim] = SIZE
247274 return fixed
248275
276 def rig_shared(self) -> List[str]:
277 """Nodes every frame's rig reuses: a lit textured sphere scene, and the animated plate for the time rig."""
278 a = ("PlateA", "Output")
279 sphere = {"Shape": FuID("SurfaceSphereInputs")}
280 t3 = lambda x=0.0, y=0.0, z=0.0: {"Transform3DOp.Translate.X": x, "Transform3DOp.Translate.Y": y, "Transform3DOp.Translate.Z": z}
281 if self.rig == "time":
282 return [
283 linear_spline("TimeA", {0: 0.0, 48: 1.0}),
284 linear_spline("TimeB", {0: 1.0, 48: 0.0}),
285 op_block("TimeBG", "Background", {
286 "Width": SIZE, "Height": SIZE, "Type": FuID("Horizontal"), "TopLeftBlue": 0.2, "TopRightBlue": 0.2,
287 "TopLeftAlpha": 1, "TopRightAlpha": 1,
288 }, {
289 "TopLeftRed": ("TimeA", "Value"), "TopLeftGreen": ("TimeB", "Value"),
290 "TopRightRed": ("TimeB", "Value"), "TopRightGreen": ("TimeA", "Value"),
291 }),
292 ]
293 if self.rig not in ("scene", "material"):
294 return []
295 return [
296 op_block("Cam", "Camera3D", {"Transform3DOp.Translate.Z": 3.0}, {}),
297 op_block("Pt", "LightPoint", t3(1.5, 1.5, 3.0), {}),
298 op_block("Amb", "LightAmbient", {"Intensity": 0.25}, {}),
299 op_block("BaseDir", "LightDirectional", {"Intensity": 0.4, "Transform3DOp.Rotate.X": -30.0, "Transform3DOp.Rotate.Y": 20.0}, {}),
300 op_block("Sph", "Shape3D", sphere, {"MaterialInput": a}),
301 op_block("SphL", "Shape3D", {**sphere, "SurfaceSphereInputs.Radius": 0.5, **t3(-0.7)}, {"MaterialInput": a}),
302 op_block("BoxR", "Shape3D", {"Shape": FuID("SurfaceCubeInputs"), "SurfaceCubeInputs.Size": 0.8, **t3(0.8)}, {"MaterialInput": ("PlateB", "Output")}),
303 op_block("WSph", "Shape3D", {**sphere, "SurfaceSphereInputs.Radius": 0.5}, {}),
304 op_block("Wall", "Shape3D", {"Shape": FuID("SurfacePlaneInputs"), "SurfacePlaneInputs.Width": 6.0, "SurfacePlaneInputs.Height": 6.0, **t3(z=-0.8)}, {}),
305 op_block("Noise", "FastNoise", {"Width": SIZE, "Height": SIZE}, {}),
306 op_block("RedMtl", "MtlBlinn", {"Diffuse.Color.Red": 0.9, "Diffuse.Color.Green": 0.15, "Diffuse.Color.Blue": 0.1}, {}),
307 op_block("BaseTex", "Texture2DOperator", {}, {"Input": a}),
308 ]
309
310 def rig_frame(self, f: int, name: str, inputs: Dict[str, Any], links: Dict[str, Tuple[str, str]]) -> Tuple[List[str], str]:
311 """Harness for one variation: tool `name` placed in its rig; returns (nodes, op feeding the Switch tree)."""
312 t, a = self.tool, ("PlateA", "Output")
313 if self.rig == "time":
314 links.update({i: ("TimeBG", "Output") for i in self.wired_images})
315 return [op_block(name, self.kind, inputs, links)], name
316 if self.rig == "particle":
317 emitter = (f"E{f}", "Output")
318 nodes = [] if t == "pEmitter" else [op_block(emitter[0], "pEmitter", EMITTER, {})]
319 if t == "pMerge":
320 nodes.append(op_block(f"E2_{f}", "pEmitter", {**EMITTER, "RandomSeed": 7, "SphereRgn.Translate.X": 0.3}, {}))
321 links.update({"Particles1": emitter, "Particles2": (f"E2_{f}", "Output")})
322 elif t != "pEmitter":
323 links["Input"] = emitter
324 nodes.append(op_block(name, self.kind, inputs, links))
325 if t == "pRender":
326 return nodes, name
327 return nodes + [op_block(f"R{f}", "pRender", PRENDER, {"Input": (name, self.out_id)})], f"R{f}"
328
329 tool_out = (name, self.out_id)
330 lit = ["Sph", "Pt", "Amb", "Cam"]
331 if self.rig == "material":
332 nodes, mtl = [], (name, "MaterialOutput")
333 if t in ("MtlBlinn", "MtlPhong", "MtlCookTorrance"):
334 links["Diffuse.Color.Material"] = a
335 elif t == "BumpMap":
336 links["Input"] = ("Noise", "Output")
337 nodes.append(op_block(f"Bm{f}", "MtlBlinn", {}, {"Diffuse.Color.Material": a, "Bumpmap.Material": mtl}))
338 mtl = (f"Bm{f}", "MaterialOutput")
339 elif t == "TextureTransformOperator":
340 links["MaterialInput"] = ("BaseTex", "MaterialOutput")
341 nodes += [op_block(name, self.kind, inputs, links), op_block(f"S{f}", "Shape3D", {"Shape": FuID("SurfaceSphereInputs")}, {"MaterialInput": mtl})]
342 scene = [(f"S{f}", "Output")] + [(n, "Output") for n in lit[1:]]
343 else:
344 scene = [(n, "Output") for n in lit]
345 if t in ("Shape3D", "Cube3D", "ImagePlane3D", "Text3D"):
346 if t in TEXTURE_SLOT:
347 links[TEXTURE_SLOT[t]] = a
348 scene[0] = tool_out
349 elif t in ("LightAmbient", "LightDirectional", "LightPoint", "LightSpot"):
350 scene = [(n, "Output") for n in ("WSph", "Wall", "Cam")] + [tool_out]
351 if t == "LightAmbient":
352 scene.append(("BaseDir", "Output"))
353 elif t == "Camera3D":
354 scene[3] = tool_out
355 elif t == "Merge3D":
356 links.update({"SceneInput1": ("SphL", "Output"), "SceneInput2": ("BoxR", "Output")})
357 scene[0] = tool_out
358 elif t == "Renderer3D":
359 inputs = {k.replace("RendererSoftware.", "RendererOpenGL.") if k.endswith(("LightingEnabled", "ShadowsEnabled")) else k: v for k, v in inputs.items()}
360 links["SceneInput"] = (f"M{f}", "Output")
361 else:
362 links["SceneInput"] = ("Sph", "Output")
363 if t == "Displace3D":
364 links["Input"] = ("Noise", "Output")
365 elif t == "ReplaceMaterial3D":
366 links["MaterialInput"] = ("RedMtl", "MaterialOutput")
367 scene[0] = tool_out
368 nodes = [op_block(name, self.kind, inputs, links)]
369 nodes.append(op_block(f"M{f}", "Merge3D", {}, {f"SceneInput{k + 1}": src for k, src in enumerate(scene)}))
370 if t == "Renderer3D":
371 return nodes, name
372 return nodes + [op_block(f"Ren{f}", "Renderer3D", RENDERER3D, {"SceneInput": (f"M{f}", "Output")})], f"Ren{f}"
373
249374 def build(self, plates: Dict[str, str]) -> Tuple[str, List[Tuple[int, str]]]:
250375 tools: List[str] = [
251376 make_loader("PlateA", plates["color"]),
......@@ -261,6 +386,7 @@ class Fuzzer:
261386 "BottomRightRed": 1, "BottomRightGreen": 1, "BottomRightBlue": 1, "BottomRightAlpha": 0.2,
262387 }, {}),
263388 ]
389 tools += self.rig_shared()
264390 if self.shape_inputs or self.out_type == "ShapeTree" or self.kind == "sRender":
265391 tools.append(op_block("ShapeA", "sRectangle", {}, {}))
266392 tools.append(op_block("ShapeB", "sEllipse", {}, {}))
......@@ -281,6 +407,12 @@ class Fuzzer:
281407 links["EffectMask"] = ("MaskSrc", "Output")
282408 inputs = {**fixed, **overrides}
283409 name = f"T{f}"
410 if self.rig:
411 nodes, out = self.rig_frame(f, name, inputs, links)
412 tools += nodes
413 outs.append(out)
414 cases.append((f, label))
415 continue
284416 tools.append(op_block(name, self.kind, inputs, links))
285417 out = name
286418 if self.out_type == "Mask":
......@@ -299,6 +431,8 @@ class Fuzzer:
299431 tools += tree
300432 tools.append(make_saver(root, f"fn_{self.tool_slug()}"))
301433 comp = make_comp("\n".join(tools + splines), len(outs) - 1, w=SIZE, h=SIZE)
434 if self.rig == "time": # Fusion fails any request outside GlobalRange, and retiming reaches far outside the render range
435 comp = comp.replace(f"GlobalRange = {{ 0, {len(outs) - 1} }}", "GlobalRange = { -100, 200 }")
302436 return comp, cases
303437
304438 def tool_slug(self) -> str: