diff --git a/docs/research/geonodes-translation-corpus.md b/docs/research/geonodes-translation-corpus.md index 8f3cfe5..fe7a891 100644 --- a/docs/research/geonodes-translation-corpus.md +++ b/docs/research/geonodes-translation-corpus.md @@ -130,6 +130,16 @@ Use these only after the smaller idioms are reliable. - Translation value: recursive-looking branch systems, curve distortion, instance orientation, scale variation, and material variation. +- `IRCSS/Blender-Geometry-Node-French-Houses` + - Source: https://github.com/IRCSS/Blender-Geometry-Node-French-Houses + - Completed foothold: + `docs/research/translations/ircss-french-houses.md` + - Why it matters: city-scale architectural kit with houses, gates, towers, + walls, bridges, church parts, stalls, terrain, roads, vegetation, banners, + windows, doors, and roofs. + - Translation value: hierarchical procedural city systems, façade organs, + topology generators, repeat/foreach/gizmo blockers, and reusable spines. + ## First Translation Target Start with `Shriinivas/geometrynodes` because it is public, GitHub-hosted, MIT @@ -245,6 +255,16 @@ Completed Blender raycast minigame foothold: - Translation value: direction vectors, curve breadcrumbs, raycast hit updates, reflected vectors, and object-target controls. +Completed IRCSS French Houses foothold: + +- `docs/research/translations/ircss-french-houses.md` +- Source group: `MakeSpiral` +- Verification: output curve converted to points matches source with ordered + max vertex delta `0.0`. +- Translation value: procedural-city corpus triage, spiral architectural + spines, and explicit blockers for repeat-zone feedback, repeat `Top` outputs, + foreach zones, gizmo nodes, and converter duplicate-key failures. + Inspected but deferred official demo files: - `hexgrid_blender_geometry_nodes_demo.blend`: mostly legacy undefined nodes diff --git a/docs/research/procedural-doctrine.md b/docs/research/procedural-doctrine.md index b2a11b2..515e578 100644 --- a/docs/research/procedural-doctrine.md +++ b/docs/research/procedural-doctrine.md @@ -120,6 +120,44 @@ Verification cue: compare the sampled path or the realized mesh. If downstream topology order matters, direct vertex order matters; otherwise sorted vertex comparison may be enough to prove the same visible path. +## Spines Carry Architecture + +Reach for spine curves when a larger architectural feature needs a route before +it needs walls, treads, beams, rails, or trim: spiral stairs, winding roads, +bridges, ribs, towers, vines, banners, cables, and roof seams. + +Mental move: author the centerline as a parameterized scaffold first. Attach +parts later. In the IRCSS French Houses file, `MakeSpiral` gives the staircase +system a screw-thread path before stair geometry is hung from it. + +```python +rail = curve_line(mode=CurveLine.Mode.POINTS, start=(0.0, 0.0, 0.0), end=(0.0, 0.0, 1.0)) +samples = resample_curve(keep_last_segment=True, curve=rail, mode="Count", count=200) +point_count = domain_size(component="CURVE", geometry=samples).point_count +t = math(operation=Math.Operation.DIVIDE, value=(index(), point_count)) +theta = math(operation=Math.Operation.MULTIPLY, value=(t, frequency)) +expanding_radius = math( + operation=Math.Operation.ADD, + value=(radius, math(operation=Math.Operation.MULTIPLY, value=(t, height_radius_gain))), +) +positioned = set_position( + geometry=samples, + position=combine_xyz( + x=math(operation=Math.Operation.MULTIPLY, value=(math(operation=Math.Operation.SINE, value=theta), expanding_radius)), + y=math(operation=Math.Operation.MULTIPLY, value=(math(operation=Math.Operation.COSINE, value=theta), expanding_radius)), + z=math(operation=Math.Operation.MULTIPLY, value=(t, height)), + ), +) +``` + +Metaphor in use: the spine is the chalk line on the floor before the carpentry +starts. If the chalk line is wrong, every beautiful tread and railing becomes +obedient nonsense. + +Verification cue: compare ordered curve points. A spine is order-sensitive; +sorted vertices can hide a route that doubles back through the right positions +in the wrong sequence. + ## Fields Are Weather Reach for fields when the shape should respond to position, index, normal, diff --git a/docs/research/translations/ircss-french-houses.md b/docs/research/translations/ircss-french-houses.md new file mode 100644 index 0000000..52ae411 --- /dev/null +++ b/docs/research/translations/ircss-french-houses.md @@ -0,0 +1,98 @@ +# Translation: IRCSS French Houses Foothold + +## Source + +- Repository: https://github.com/IRCSS/Blender-Geometry-Node-French-Houses +- Source file: + `GeometryNodesFrenchHous.blend` +- Source group translated in this pass: + - `MakeSpiral` +- Geometry Script recreation: + `examples/geometry_script/ircss_french_houses.py` + +## Why This File + +This is the first genuinely city-scale corpus target. The inspected `.blend` +contains 108 geometry node groups, including thousand-node architectural +systems: + +- `CreateGate`: 1081 nodes / 1234 links +- `GenerateHouse`: 1023 nodes / 1075 links +- `GenerateChurchBuildingB`: 893 nodes / 1124 links +- `Generate Square Tower`: 805 nodes / 877 links +- `ChurchFrontTowers`: 792 nodes / 990 links +- `Generate Tower`: 707 nodes / 754 links + +The file is a town-building kit: houses, gates, towers, walls, bridges, church +parts, stalls, cliffs, roads, rivers, vegetation, banners, windows, doors, and +roof systems. This is the right quarry for procedural-city doctrine, but the +first accepted bite has to be small enough to verify. + +## First Accepted Graph + +Source group: `MakeSpiral` + +Geometry Script group: `VG Make Spiral` + +Mechanism: + +- Create a vertical curve line from `(0, 0, 0)` to `(0, 0, 1)`. +- Resample it to 200 points. +- Use `Index / Point Count` as a normalized parameter `t`. +- Compute angle as `t * Frequency`. +- Compute radius as `Radius + t * HeightRadiusGain`. +- Place each point at: + - `x = sin(angle) * radius` + - `y = cos(angle) * radius` + - `z = t * Height` + +Metaphor: the spiral is a screw-thread spine. Stairs, rails, walls, and +decorative ribs can hang from it later, but the first job is to prove the spine +lands in the same places as the source. + +## Verification + +Run: + +```powershell +& 'C:\Program Files (x86)\Steam\steamapps\common\Blender\blender.exe' --background '.\experiments\source-blends\ircss-french-houses.blend' --python '.\tools\verify_ircss_french_houses_translations.py' +``` + +Results from Blender 5.1.1: + +| Case | Source vertices | Translated vertices | Delta | Status | +| --- | ---: | ---: | ---: | --- | +| MakeSpiral curve points | 200 | 200 | 0.0 | accepted | + +The verifier converts the output curve to evaluated points and compares ordered +vertex positions. + +## Blockers Exposed + +- `GenerateMedialAxisRectangleTopology` is a strong next target, but it uses a + repeat-zone feedback loop and exposes the repeat `Top` boolean as a group + output. The current Geometry Script path does not provide a clean linkable + socket for that output. +- `GenerateBricks` also uses repeat-zone geometry accumulation. Blender's + source graph can leave the repeat geometry seed implicit; the current DSL + path exposed the previous-geometry state as `None`. +- `GenerateWindowsFromEdges` uses `For Each Geometry Element` zones. +- `Pole` uses repeat zones and geometry-node gizmos. +- `GenerateArc` and `MakeStairs` exposed a `nodes_to_script` converter bug: + duplicated keyword arguments for `primary_axis`. +- `WindowBeams` depends on specific upstream edge/curve inputs. A synthetic + harness could verify its secondary base-point output, but the main beam mesh + stayed empty for both source and translation. That was rejected as an + acceptance target. + +## Lessons + +- City-scale graphs are hierarchies of organs. Start with reusable spines, + tiles, rails, façade parts, and topology generators before translating a + thousand-node composer. +- Converter drafts are still useful for triage: they quickly separate clean + helpers, repeat-zone blockers, foreach-zone blockers, gizmo-specific groups, + and false symbol names. +- Verification harnesses must reject empty success. If both source and + translation output zero visible vertices for the main contract, the harness + is not proving the graph. diff --git a/examples/geometry_script/ircss_french_houses.py b/examples/geometry_script/ircss_french_houses.py new file mode 100644 index 0000000..7e374bd --- /dev/null +++ b/examples/geometry_script/ircss_french_houses.py @@ -0,0 +1,66 @@ +"""Geometry Script footholds from IRCSS/Blender-Geometry-Node-French-Houses.""" + +try: + from tools.geometry_script_loader import load_repo_geometry_script +except ModuleNotFoundError: + import sys + from pathlib import Path + + sys.path.insert(0, str(Path(__file__).resolve().parents[2])) + from tools.geometry_script_loader import load_repo_geometry_script + +load_repo_geometry_script() + +from geometry_script import * # noqa: F403 - Geometry Script exposes node functions as DSL globals. +@tree("VG Make Spiral") +def vg_make_spiral( + frequency: Float = 12.0, + radius: Float = 1.0, + height: Float = 3.0, + height_radius_gain: Float = 0.0, +): + rail = curve_line(mode=CurveLine.Mode.POINTS, start=(0.0, 0.0, 0.0), end=(0.0, 0.0, 1.0)) + samples = resample_curve(keep_last_segment=True, curve=rail, mode="Count", count=200, length=0.10000000149011612) + point_count = domain_size(component="CURVE", geometry=samples).point_count + t = math(operation=Math.Operation.DIVIDE, value=(index(), point_count)) + theta = math(operation=Math.Operation.MULTIPLY, value=(t, frequency)) + expanding_radius = math( + operation=Math.Operation.ADD, + value=(radius, math(operation=Math.Operation.MULTIPLY, value=(t, height_radius_gain))), + ) + x = math( + operation=Math.Operation.MULTIPLY, + value=(math(operation=Math.Operation.SINE, value=theta), expanding_radius), + ) + y = math( + operation=Math.Operation.MULTIPLY, + value=(math(operation=Math.Operation.COSINE, value=theta), expanding_radius), + ) + z = math(operation=Math.Operation.MULTIPLY, value=(t, height)) + return {"Geometry": set_position(geometry=samples, position=combine_xyz(x=x, y=y, z=z), offset=(0.0, 0.0, 0.0))} + + +def _finalize_groups(): + import bpy + + groups = [] + for name in ("VG Make Spiral",): + group = bpy.data.node_groups.get(name) + if group: + group.use_fake_user = True + groups.append(group) + return groups + + +_finalize_groups() + + +if __name__ == "__main__": + for group in _finalize_groups(): + print( + "VG_IRCSS_GROUP", + group.name, + len(group.nodes), + len(group.links), + sorted(set(node.bl_idname for node in group.nodes)), + ) diff --git a/notes/fresh-workspace-handoff.md b/notes/fresh-workspace-handoff.md index 58f1f0a..8ed47ec 100644 --- a/notes/fresh-workspace-handoff.md +++ b/notes/fresh-workspace-handoff.md @@ -68,6 +68,15 @@ The completed official Blender demo tranche now includes: - `docs/research/translations/blender-raycast-minigame.md`, covering `Initial Direction`, `Line to be Casted`, and `Cast Rays`. +The first city-scale corpus target is +`docs/research/translations/ircss-french-houses.md`, backed by +`examples/geometry_script/ircss_french_houses.py`. The accepted foothold is +`MakeSpiral -> VG Make Spiral`, verified with 200 ordered curve points matching +source geometry at max delta `0.0`. The same pass mapped larger blockers: +repeat-zone feedback state, repeat `Top` boolean outputs, foreach zones, gizmo +nodes, `nodes_to_script` duplicate-key failures around axes-to-rotation, and a +rejected empty-output harness for `WindowBeams`. + Official demo files inspected but deferred are listed in `docs/research/geonodes-translation-corpus.md`: hexgrid, wavy wall, pebble scattering, gizmo array, jiggly pudding, and repeat-zone flower. They are not @@ -99,10 +108,10 @@ The GameCult fork is intentionally pruned to `main` plus VibeGeometry-owned tooling branches. Upstream branch clutter should not be copied forward unless a future patch actually needs it. -The current next action is to move from translation-corpus chewing into the -next architecture organ: define the scene brief and node graph manifest -contracts using the verified idioms and deferred-zone blockers as pressure -cases. Keep `docs/research/procedural-doctrine.md` compact; put +The current next action is to continue IRCSS French Houses by choosing the next +city-organ target after either fixing repeat-zone/foreach/gizmo toolchain +blockers or selecting another non-zone architectural helper with a non-empty +behavioral harness. Keep `docs/research/procedural-doctrine.md` compact; put sample-specific graph maps and verification details in `docs/research/translations/`. diff --git a/state/evidence.jsonl b/state/evidence.jsonl index 917e7f9..e630c89 100644 --- a/state/evidence.jsonl +++ b/state/evidence.jsonl @@ -26,3 +26,4 @@ {"ts": "2026-05-04T14:59:36+00:00", "type": "implementation", "status": "ok", "note": "Started CurveToMeshUV utility sample by translating and verifying Auto Smooth; main Curve to Mesh UV remains a staged utility-quarry target rather than a one-pass translation."} {"ts": "2026-05-04T15:57:11+00:00", "type": "implementation", "status": "ok", "note": "Finished remaining local sample graph families: extended pie clones/compositor, param/polar selector and wrapper, and full CurveToMeshUV utility/demo/title with mesh, UV-field, and caps-mask harness verification."} {"ts": "2026-05-04T16:56:12+00:00", "type": "implementation", "status": "accepted", "note": "Expanded the verified Geometry Nodes translation corpus with official Blender demo samples: instance attributes grass tuft, index-of-nearest helpers, shortest-path labyrinth, and raycast minigame helpers. All new verifiers pass in Blender 5.1.1 with sorted max vertex delta 0.0 across their harness cases. Deferred official samples are classified as legacy-node, gizmo-node, simulation-zone, or repeat-zone targets rather than padded into doctrine."} +{"ts": "2026-05-04T17:15:09+00:00", "type": "research", "status": "accepted", "note": "Started IRCSS French Houses city-scale corpus target. Inspected 108 geometry node groups and verified first foothold MakeSpiral -> VG Make Spiral with 200 ordered curve points matching source at max delta 0.0. Recorded blockers from larger city graphs: repeat-zone feedback state, repeat Top output sockets, foreach zones, gizmo nodes, converter duplicate-key failures, and empty-output harness rejection."} diff --git a/state/map.yaml b/state/map.yaml index 68e50ed..4d285db 100644 --- a/state/map.yaml +++ b/state/map.yaml @@ -91,8 +91,8 @@ data_flow: - If state grows faster than understanding, cut it back. current_status: - summary: VibeGeometry has an initial persistence scaffold plus verified Geometry Script translations for local math/utility samples and a first official Blender demo tranche: instance attributes grass tuft, index-of-nearest helpers, shortest-path labyrinth, and raycast minigame helpers. Deferred official samples are now classified when they require legacy-node migration, gizmo-node authoring, repeat-zone support, or simulation-zone support. The repo-local Geometry Script fork includes a Blender 5.1 nodes_to_script converter port plus nested-group and menu-socket fixes needed by these translations. - next_action: Move from translation-corpus chewing into the next architecture organ: define the scene brief and node graph manifest contracts using the verified idioms and deferred-zone blockers as pressure cases. + summary: VibeGeometry has an initial persistence scaffold plus verified Geometry Script translations for local math/utility samples, a first official Blender demo tranche, and an initial IRCSS French Houses city-scale foothold. The IRCSS pass verified MakeSpiral and mapped blockers in larger architectural systems: repeat-zone feedback, repeat Top outputs, foreach zones, gizmo nodes, and converter duplicate-key failures. The repo-local Geometry Script fork includes a Blender 5.1 nodes_to_script converter port plus nested-group and menu-socket fixes needed by these translations. + next_action: Continue IRCSS French Houses by choosing the next city-organ target after either fixing repeat-zone/foreach/gizmo toolchain blockers or selecting another non-zone architectural helper with a non-empty behavioral harness. remotes: vibegeometry: https://github.com/GameCult/VibeGeometry geometry_script_fork: https://github.com/GameCult/geometry-script diff --git a/tools/verify_ircss_french_houses_translations.py b/tools/verify_ircss_french_houses_translations.py new file mode 100644 index 0000000..1df3c9d --- /dev/null +++ b/tools/verify_ircss_french_houses_translations.py @@ -0,0 +1,120 @@ +"""Compare selected IRCSS French Houses groups against Geometry Script translations.""" + +from __future__ import annotations + +import importlib.util +import json +import math +import sys +from pathlib import Path + +import bpy + + +ROOT = Path(__file__).resolve().parents[1] +TRANSLATION = ROOT / "examples" / "geometry_script" / "ircss_french_houses.py" +CASE = { + "Frequency": 12.0, + "Radius": 1.0, + "Height": 3.0, + "HeightRadiusGain": 0.25, +} + + +def _load_translation() -> None: + spec = importlib.util.spec_from_file_location("vg_ircss_french_houses_translation", TRANSLATION) + if spec is None or spec.loader is None: + raise RuntimeError(f"Could not load translation script: {TRANSLATION}") + module = importlib.util.module_from_spec(spec) + sys.modules[spec.name] = module + spec.loader.exec_module(module) + + +def _socket_by_name(sockets, name: str): + for socket in sockets: + if socket.name == name: + return socket + raise KeyError(name) + + +def _socket_key(name: str) -> str: + return name.lower().replace(" ", "").replace("_", "") + + +def _set_inputs(group_node: bpy.types.GeometryNode, inputs: dict[str, object]) -> None: + normalized = {_socket_key(key): value for key, value in inputs.items()} + for socket in group_node.inputs: + key = _socket_key(socket.name) + if key in normalized: + socket.default_value = normalized[key] + + +def _new_geometry_group(name: str) -> bpy.types.GeometryNodeTree: + if name in bpy.data.node_groups: + bpy.data.node_groups.remove(bpy.data.node_groups[name]) + group = bpy.data.node_groups.new(name, "GeometryNodeTree") + group.is_modifier = True + group.interface.new_socket(name="Geometry", in_out="INPUT", socket_type="NodeSocketGeometry") + group.interface.new_socket(name="Geometry", in_out="OUTPUT", socket_type="NodeSocketGeometry") + return group + + +def _build_spiral_wrapper(name: str, group: bpy.types.GeometryNodeTree): + wrapper = _new_geometry_group(name) + nodes = wrapper.nodes + links = wrapper.links + group_node = nodes.new("GeometryNodeGroup") + group_node.node_tree = group + _set_inputs(group_node, CASE) + + points = nodes.new("GeometryNodeCurveToPoints") + points.mode = "EVALUATED" + links.new(_socket_by_name(group_node.outputs, "Geometry"), _socket_by_name(points.inputs, "Curve")) + vertices = nodes.new("GeometryNodePointsToVertices") + links.new(_socket_by_name(points.outputs, "Points"), _socket_by_name(vertices.inputs, "Points")) + + group_output = nodes.new("NodeGroupOutput") + links.new(_socket_by_name(vertices.outputs, "Mesh"), _socket_by_name(group_output.inputs, "Geometry")) + return wrapper + + +def _evaluated_vertices(group: bpy.types.GeometryNodeTree): + mesh = bpy.data.meshes.new(group.name + " Input Mesh") + obj = bpy.data.objects.new(group.name + " Object", mesh) + bpy.context.collection.objects.link(obj) + modifier = obj.modifiers.new(group.name + " Modifier", "NODES") + modifier.node_group = group + depsgraph = bpy.context.evaluated_depsgraph_get() + evaluated = obj.evaluated_get(depsgraph) + evaluated_mesh = evaluated.to_mesh() + try: + return [tuple(vertex.co) for vertex in evaluated_mesh.vertices] + finally: + evaluated.to_mesh_clear() + + +def main() -> int: + _load_translation() + source = _evaluated_vertices(_build_spiral_wrapper("VG Verify Source MakeSpiral", bpy.data.node_groups["MakeSpiral"])) + translated = _evaluated_vertices( + _build_spiral_wrapper("VG Verify Translated MakeSpiral", bpy.data.node_groups["VG Make Spiral"]) + ) + max_delta = ( + max((math.dist(a, b) for a, b in zip(source, translated)), default=0.0) + if len(source) == len(translated) + else math.inf + ) + result = { + "case": "make_spiral_curve_points", + "source_vertex_count": len(source), + "translated_vertex_count": len(translated), + "max_ordered_vertex_delta": max_delta, + } + result["ok"] = len(source) == len(translated) and max_delta <= 1e-6 + payload = {"ok": result["ok"], "results": [result]} + print("VG_IRCSS_FRENCH_HOUSES_TRANSLATION_BEHAVIOR " + json.dumps(payload, sort_keys=True)) + return 0 if payload["ok"] else 1 + + +if __name__ == "__main__": + raise SystemExit(main())