Expand official geometry node corpus
This commit is contained in:
parent
182b2f17c6
commit
3c4ad988c3
17 changed files with 1883 additions and 6 deletions
|
|
@ -35,6 +35,17 @@ modifier sockets, and basic graph inspection.
|
|||
|
||||
Use these after the primitive layer can be recreated without guessing.
|
||||
|
||||
- Blender public Geometry Nodes demo: instance attributes grass tuft
|
||||
- Source:
|
||||
https://download.blender.org/demo/geometry-nodes/instance_attribtues.blend
|
||||
- Completed entry:
|
||||
`docs/research/translations/blender-instance-attributes.md`
|
||||
- Why it matters: compact scatter graph that captures instance root position
|
||||
before realization and uses it to curl each realized blade.
|
||||
- Translation value: distribute points, instance on points, scale instances,
|
||||
capture attributes on instance domain, realize instances, tangent-axis
|
||||
deformation, and profile-scaled curve-to-mesh output.
|
||||
|
||||
- Blender Guru beginner Geometry Nodes candy tutorial
|
||||
- Source: https://www.blenderguru.com/tutorials/2025/9/10/blender-tutorial-geometry-nodes-for-beginners
|
||||
- Candidate artifact: downloadable final `.blend`
|
||||
|
|
@ -73,6 +84,36 @@ Use these to learn how artists package node networks into inspectable tools.
|
|||
|
||||
Use these only after the smaller idioms are reliable.
|
||||
|
||||
- Blender public Geometry Nodes demo: Index Of Nearest
|
||||
- Source: https://download.blender.org/demo/geometry-nodes/index_of_nearest.blend
|
||||
- Completed entry:
|
||||
`docs/research/translations/blender-index-of-nearest.md`
|
||||
- Why it matters: compact helper groups around a simulation-zone point
|
||||
system.
|
||||
- Translation value: nearest-neighbor lookup, evaluate-at-index sampling,
|
||||
point-radius collision, velocity-field harnessing, and boundary/collider
|
||||
constraint helpers.
|
||||
|
||||
- Blender public Geometry Nodes demo: shortest-path labyrinth
|
||||
- Source:
|
||||
https://download.blender.org/demo/geometry-nodes/labyrinth-shortest_path-simon_thommes.blend
|
||||
- Completed entry:
|
||||
`docs/research/translations/blender-labyrinth-shortest-path.md`
|
||||
- Why it matters: compact pathfinding system built around shortest edge
|
||||
paths and path-to-curve conversion.
|
||||
- Translation value: topology-first graph structure, edge path selection,
|
||||
path capture before deletion, filleted curve output, and solution reveal
|
||||
control.
|
||||
|
||||
- Blender public Geometry Nodes demo: raycast minigame
|
||||
- Source: https://download.blender.org/demo/geometry-nodes/raycast-minigame.blend
|
||||
- Completed entry:
|
||||
`docs/research/translations/blender-raycast-minigame.md`
|
||||
- Why it matters: small ray-step helper groups inside a larger game-like
|
||||
procedural setup.
|
||||
- Translation value: initial direction vectors, sampled ray lines, raycast
|
||||
hit updates, reflected direction, and curve-output harnessing.
|
||||
|
||||
- Blender Studio Geometry Nodes from Scratch files
|
||||
- Source: https://studio.blender.org/training/geometry-nodes-from-scratch/chapter/files/
|
||||
- Candidate files: rock scattering, tree generator, grass tuft generator,
|
||||
|
|
@ -164,6 +205,60 @@ Completed CurveToMeshUV utility entry:
|
|||
harness, caps-mask harness, demo geometry, and title geometry all match
|
||||
source evaluated geometry.
|
||||
|
||||
Completed Blender instance attributes entry:
|
||||
|
||||
- `docs/research/translations/blender-instance-attributes.md`
|
||||
- Source group: `Grass Tuft Generator`
|
||||
- Verification: default and wider/curlier/seeded control cases match source
|
||||
evaluated geometry with sorted max vertex delta `0.0`; edge counts, polygon
|
||||
counts, and smooth-face flags also match.
|
||||
- Translation value: scatter nurseries, reused radial falloff, instance-domain
|
||||
capture before realization, and per-blade curl driven by remembered root
|
||||
position.
|
||||
|
||||
Completed Blender index-of-nearest helper entry:
|
||||
|
||||
- `docs/research/translations/blender-index-of-nearest.md`
|
||||
- Source groups: `boundary_step`, `update_velocity`, `collision_step`,
|
||||
`collider_step`
|
||||
- Verification: helper harnesses match source evaluated geometry with sorted
|
||||
max vertex delta `0.0`.
|
||||
- Translation value: constraint projection, velocity capping, nearest-neighbor
|
||||
collision, and point-output verification harnesses.
|
||||
|
||||
Completed Blender shortest-path labyrinth entry:
|
||||
|
||||
- `docs/research/translations/blender-labyrinth-shortest-path.md`
|
||||
- Source group: `Solvable Labyrinth Generator`
|
||||
- Verification: small unsolved and solved cases match source evaluated
|
||||
geometry with sorted max vertex delta `0.0`; edge and polygon counts also
|
||||
match.
|
||||
- Translation value: shortest edge paths, path capture, topology carving,
|
||||
path-to-curve conversion, and solution reveal.
|
||||
|
||||
Completed Blender raycast minigame foothold:
|
||||
|
||||
- `docs/research/translations/blender-raycast-minigame.md`
|
||||
- Source groups: `Initial Direction`, `Line to be Casted`, `Cast Rays`
|
||||
- Verification: direction, line, and raycast-step harnesses match source
|
||||
evaluated geometry with sorted max vertex delta `0.0`.
|
||||
- Translation value: direction vectors, curve breadcrumbs, raycast hit updates,
|
||||
reflected vectors, and object-target controls.
|
||||
|
||||
Inspected but deferred official demo files:
|
||||
|
||||
- `hexgrid_blender_geometry_nodes_demo.blend`: mostly legacy undefined nodes
|
||||
in Blender 5.1, plus a duplicate `Auto Smooth` helper already covered.
|
||||
- `wavy_procedural_wall.blend`: several legacy/undefined attribute-toolkit
|
||||
groups; useful later as migration quarry, not current doctrine.
|
||||
- `pebble_scattering.blend`: legacy undefined nodes dominate the single group.
|
||||
- `gizmo_array.blend`: focused on Blender 4.3+ geometry-node gizmo nodes.
|
||||
Needs a dedicated gizmo-authoring pass.
|
||||
- `jiggly_pudding.blend`: simulation-zone graph. Needs dedicated simulation
|
||||
zone support and verification discipline.
|
||||
- `repeat_zone_flower_by_MiRA.blend`: repeat-zone flower system. Needs a
|
||||
repeat-zone pass before translation.
|
||||
|
||||
## Extraction Workflow
|
||||
|
||||
1. Download one source `.blend` into an ignored experiment folder.
|
||||
|
|
|
|||
|
|
@ -460,6 +460,188 @@ of instances and domains, untagged values are gone in the baggage system.
|
|||
Verification cue: test the full composed graph after realization or deletion,
|
||||
not just the captured helper. The point of capture is later survival.
|
||||
|
||||
## Scatter In Layers
|
||||
|
||||
Reach for scatter layering when the target is grass, fur, candies, rivets,
|
||||
pebbles, bubbles, leaves, scales, debris, or any repeated body distributed over
|
||||
a surface.
|
||||
|
||||
Mental move: separate the nursery from the bodies. First make the surface that
|
||||
decides where points may live. Then make the point field that controls density,
|
||||
spacing, randomness, scale, and seed. Then instance a separately named body and
|
||||
only realize it when later deformation needs real vertices.
|
||||
|
||||
```python
|
||||
base_disc = mesh_circle(fill_type=MeshCircle.FillType.TRIANGLE_FAN, vertices=12, radius=radius)
|
||||
scattered_surface = subdivide_mesh(mesh=base_disc, level=3)
|
||||
radial_distance = vector_math(operation=VectorMath.Operation.LENGTH, vector=position())
|
||||
radial_falloff = map_range(
|
||||
clamp=True,
|
||||
interpolation_type="SMOOTHSTEP",
|
||||
data_type="FLOAT",
|
||||
value=radial_distance,
|
||||
from_min=0.0,
|
||||
from_max=radius,
|
||||
to_min=1.0,
|
||||
to_max=0.38999998569488525,
|
||||
)
|
||||
points = distribute_points_on_faces(
|
||||
distribute_method="POISSON",
|
||||
mesh=scattered_surface,
|
||||
distance_min=math(
|
||||
operation=Math.Operation.DIVIDE,
|
||||
value=(math(operation=Math.Operation.MULTIPLY, value=(thickness, 2.0)), density),
|
||||
),
|
||||
density_max=math(operation=Math.Operation.MULTIPLY, value=(density, 5000.0)),
|
||||
density_factor=radial_falloff,
|
||||
seed=seed,
|
||||
)
|
||||
instances = instance_on_points(points=points.points, instance=tapered_blade)
|
||||
scaled = scale_instances(instances=instances, scale=radial_falloff)
|
||||
roots = _capture_attribute_item("VECTOR", "INSTANCE", scaled, position(), "Value")
|
||||
realized = realize_instances(geometry=roots.geometry, realize_all=True, depth=0)
|
||||
```
|
||||
|
||||
Metaphor in use: the scatter surface is a nursery tray. Points are planting
|
||||
holes. Instances are seedlings. Realization is when the seedlings stop being
|
||||
copies and become individual geometry you can bend, cut, or shade.
|
||||
|
||||
Verification cue: test more than one seed/control set. Scatter graphs can match
|
||||
counts at one setting while density, scale, or captured-root behavior is wrong.
|
||||
|
||||
## Constraint Helpers Are Bumpers
|
||||
|
||||
Reach for constraint helpers when a procedural system has a small physical rule
|
||||
that should be true after each update: stay inside a boundary, avoid another
|
||||
point, cap velocity, project out of a collider, or keep motion planar.
|
||||
|
||||
Mental move: express the rule as condition, projection, and `Set Position`.
|
||||
The condition says when the rule applies. The projection computes the nearest
|
||||
allowed state. `Set Position` makes the point obey.
|
||||
|
||||
```python
|
||||
from_center = vector_math(operation=VectorMath.Operation.SUBTRACT, vector=(position(), vector))
|
||||
distance = vector_math(operation=VectorMath.Operation.LENGTH, vector=from_center)
|
||||
outside = compare(
|
||||
operation=Compare.Operation.GREATER_THAN,
|
||||
data_type=Compare.DataType.FLOAT,
|
||||
mode=Compare.Mode.ELEMENT,
|
||||
a=distance,
|
||||
b=b,
|
||||
)
|
||||
clamped_xy = vector_math(
|
||||
operation=VectorMath.Operation.MULTIPLY,
|
||||
vector=(
|
||||
vector_math(
|
||||
operation=VectorMath.Operation.SCALE,
|
||||
vector=vector_math(operation=VectorMath.Operation.NORMALIZE, vector=from_center),
|
||||
scale=b,
|
||||
),
|
||||
(1.0, 1.0, 0.0),
|
||||
),
|
||||
)
|
||||
geometry = set_position(geometry=geometry, selection=outside, position=clamped_xy)
|
||||
```
|
||||
|
||||
For point collisions, make the neighbor visible as a sampled field:
|
||||
|
||||
```python
|
||||
neighbor = index_of_nearest(position=position())
|
||||
neighbor_position = evaluate_at_index(
|
||||
domain="POINT",
|
||||
data_type="FLOAT_VECTOR",
|
||||
value=position(),
|
||||
index=neighbor.index,
|
||||
)
|
||||
from_neighbor = vector_math(operation=VectorMath.Operation.SUBTRACT, vector=(position(), neighbor_position))
|
||||
push = vector_math(operation=VectorMath.Operation.SCALE, vector=from_neighbor, scale=push_strength)
|
||||
geometry = set_position(geometry=geometry, offset=push)
|
||||
```
|
||||
|
||||
Metaphor in use: these are bumpers on the table. They do not make the whole
|
||||
simulation smart; they keep one kind of stupidity from persisting into the next
|
||||
tick.
|
||||
|
||||
Verification cue: point clouds may evaluate to empty mesh summaries. When the
|
||||
promise is point position, convert points to vertices in the harness before
|
||||
comparing geometry.
|
||||
|
||||
## Paths Are Topology First
|
||||
|
||||
Reach for path nodes when the visual idea depends on connectivity: mazes,
|
||||
routes, veins, circuit traces, cracks, growth paths, street maps, or solution
|
||||
reveals.
|
||||
|
||||
Mental move: solve the graph before drawing the tube. First mark the root or
|
||||
target vertices, compute path selection on mesh topology, capture the path
|
||||
state that later deletion or conversion will destroy, then convert the accepted
|
||||
path into visible curves.
|
||||
|
||||
```python
|
||||
start_vertex = compare(
|
||||
operation=Compare.Operation.EQUAL,
|
||||
data_type=Compare.DataType.INT,
|
||||
mode=Compare.Mode.ELEMENT,
|
||||
a=index(),
|
||||
b=0,
|
||||
)
|
||||
paths = shortest_edge_paths(end_vertex=start_vertex, edge_cost=edge_cost)
|
||||
path_selection = edge_paths_to_selection(next_vertex_index=paths.next_vertex_index)
|
||||
captured_path = _capture_attribute_item("BOOLEAN", "EDGE", base_geometry, path_selection, "Path")
|
||||
subdivided = subdivide_mesh(mesh=captured_path.geometry, level=1)
|
||||
walkable = delete_geometry(
|
||||
mode=DeleteGeometry.Mode.ALL,
|
||||
domain=DeleteGeometry.Domain.POINT,
|
||||
geometry=subdivided,
|
||||
selection=captured_path.path,
|
||||
)
|
||||
solution = edge_paths_to_curves(mesh=walkable, start_vertices=far_x_vertices, next_vertex_index=paths.next_vertex_index)
|
||||
```
|
||||
|
||||
Metaphor in use: topology is the street map. Curves are the painted route.
|
||||
Paint after the route exists, or you are decorating roads that may be closed in
|
||||
the next operation.
|
||||
|
||||
Verification cue: compare solved and unsolved control states. A path graph can
|
||||
preserve topology while putting visible tubes at the wrong scale if anonymous
|
||||
value nodes are misread.
|
||||
|
||||
## Rays Are Breadcrumbs
|
||||
|
||||
Reach for raycast helpers when a path should bounce, aim, probe, measure
|
||||
distance, or react to a target object.
|
||||
|
||||
Mental move: keep the ray step explicit. Store the breadcrumb line, sample the
|
||||
previous point, cast from there, write the next point, then pass the reflected
|
||||
direction and next index forward.
|
||||
|
||||
```python
|
||||
previous_position = sample_index(
|
||||
data_type=SampleIndex.DataType.FLOAT_VECTOR,
|
||||
domain=SampleIndex.Domain.POINT,
|
||||
clamp=True,
|
||||
geometry=line,
|
||||
value=position(),
|
||||
index=math(operation=Math.Operation.SUBTRACT, value=(hit_index, integer(integer=1))),
|
||||
)
|
||||
hit = raycast(
|
||||
data_type="FLOAT_VECTOR",
|
||||
target_geometry=target_info.geometry,
|
||||
interpolation="Nearest",
|
||||
source_position=previous_position,
|
||||
ray_direction=ray_direction,
|
||||
ray_length=20.0,
|
||||
)
|
||||
updated_line = set_position(geometry=line, selection=active_point, position=hit.hit_position)
|
||||
reflected = vector_math(operation=VectorMath.Operation.REFLECT, vector=(ray_direction, hit.hit_normal))
|
||||
```
|
||||
|
||||
Metaphor in use: every hit drops a crumb and turns the flashlight. The next
|
||||
step reads the crumb, not the whole trail.
|
||||
|
||||
Verification cue: curve breadcrumbs need a curve-to-points or curve-to-mesh
|
||||
harness before evaluated mesh comparison can see them.
|
||||
|
||||
## Branch Helpers Are Switchboards
|
||||
|
||||
Reach for branch helpers when the same output contract can be fed by multiple
|
||||
|
|
|
|||
88
docs/research/translations/blender-index-of-nearest.md
Normal file
88
docs/research/translations/blender-index-of-nearest.md
Normal file
|
|
@ -0,0 +1,88 @@
|
|||
# Translation: Blender Index Of Nearest Helpers
|
||||
|
||||
## Source
|
||||
|
||||
- Source file: https://download.blender.org/demo/geometry-nodes/index_of_nearest.blend
|
||||
- Source groups translated in this pass:
|
||||
- `boundary_step`
|
||||
- `update_velocity`
|
||||
- `collision_step`
|
||||
- `collider_step`
|
||||
- Geometry Script recreation:
|
||||
`examples/geometry_script/blender_index_of_nearest.py`
|
||||
|
||||
## Why This Graph
|
||||
|
||||
The main `Geometry Nodes` group is a simulation-zone point system. The compact
|
||||
helper groups are the useful entry point: each one enforces a small physical
|
||||
rule on point positions or velocity fields.
|
||||
|
||||
## Helper Maps
|
||||
|
||||
`VG Boundary Step`:
|
||||
|
||||
- Compute point position relative to a center vector.
|
||||
- If distance exceeds boundary radius `B`, normalize the direction and place
|
||||
the point on the boundary circle.
|
||||
- Multiply by `(1, 1, 0)` to keep the constraint planar.
|
||||
|
||||
`VG Update Velocity`:
|
||||
|
||||
- Estimate movement from current `Position - Last Position`.
|
||||
- Dampen and flatten the movement vector.
|
||||
- If it exceeds the velocity cap, normalize to the cap.
|
||||
- Otherwise blend previous velocity toward the new planar movement.
|
||||
|
||||
`VG Collision Step`:
|
||||
|
||||
- Find the nearest point with `Index Of Nearest`.
|
||||
- Evaluate that neighbor's position with `Evaluate at Index`.
|
||||
- If the current point is closer than its radius, push it away a small planar
|
||||
amount.
|
||||
|
||||
`VG Collider Step`:
|
||||
|
||||
- Read an object's location and scale.
|
||||
- If a point is inside the object's scaled radius, project it to the collider
|
||||
boundary in XY.
|
||||
- The accepted Geometry Script group exposes the collider as an object input
|
||||
instead of hard-coding the source object's name.
|
||||
|
||||
Metaphor: these groups are bumpers. They do not decide the whole simulation;
|
||||
they make one small rule true each tick: stay inside the table, do not move too
|
||||
fast, stop sitting on another point, stop sitting inside the obstacle.
|
||||
|
||||
## Verification
|
||||
|
||||
Run:
|
||||
|
||||
```powershell
|
||||
& 'C:\Program Files (x86)\Steam\steamapps\common\Blender\blender.exe' --background '.\experiments\source-blends\blender-index-of-nearest.blend' --python '.\tools\verify_index_of_nearest_translations.py'
|
||||
```
|
||||
|
||||
Results from Blender 5.1.1:
|
||||
|
||||
| Case | Source vertices | Translated vertices | Delta | Status |
|
||||
| --- | ---: | ---: | ---: | --- |
|
||||
| boundary_step | 6 | 6 | 0.0 | accepted |
|
||||
| update_velocity harness | 4 | 4 | 0.0 | accepted |
|
||||
| collision_step point harness | 5 | 5 | 0.0 | accepted |
|
||||
| collider_step | 6 | 6 | 0.0 | accepted |
|
||||
|
||||
The velocity output is verified by driving `Set Position.Position` with the
|
||||
output vector. The collision output is verified by converting the resulting
|
||||
points to vertices after the helper group.
|
||||
|
||||
## Lessons
|
||||
|
||||
- Small simulation helpers are better first translation targets than full
|
||||
simulation zones.
|
||||
- Constraint groups read well when scripted as condition, projection, and
|
||||
`Set Position`.
|
||||
- Invisible vector fields need harnesses. `update_velocity` became observable
|
||||
only after using the vector output as point position.
|
||||
- Point-cloud outputs can evaluate as empty mesh summaries. Convert points to
|
||||
vertices in the verifier when point positions are the behavior under test.
|
||||
- Geometry Script's `mix(...)` helper mapped to the wrong Blender node family
|
||||
here. The accepted translation expresses the source vector mix as explicit
|
||||
scale-and-add nodes.
|
||||
74
docs/research/translations/blender-instance-attributes.md
Normal file
74
docs/research/translations/blender-instance-attributes.md
Normal file
|
|
@ -0,0 +1,74 @@
|
|||
# Translation: Blender Instance Attributes Grass Tuft
|
||||
|
||||
## Source
|
||||
|
||||
- Source file: https://download.blender.org/demo/geometry-nodes/instance_attribtues.blend
|
||||
- Source group: `Grass Tuft Generator`
|
||||
- Geometry Script recreation:
|
||||
`examples/geometry_script/blender_instance_attributes.py`
|
||||
|
||||
## Why This Graph
|
||||
|
||||
This is the first verified scatter/instance/deform sample in the corpus. It is
|
||||
small enough to translate directly, but it uses the important grown-up trick:
|
||||
capture instance state before realization, then use that remembered value to
|
||||
deform the realized geometry.
|
||||
|
||||
## Graph Map
|
||||
|
||||
Source group: `Grass Tuft Generator`
|
||||
|
||||
Geometry Script group: `VG Grass Tuft Generator`
|
||||
|
||||
Mechanism:
|
||||
|
||||
- Build a triangular-fan disc, subdivide it, and use it as the scatter nursery.
|
||||
- Compute radial distance from `Position`, remap it through `Map Range`, and
|
||||
reuse that falloff for both point density and instance scale.
|
||||
- Build one blade as a five-point vertical mesh line, convert it to a curve,
|
||||
and taper it with `Set Curve Radius` from `1 - Spline Parameter.Factor`.
|
||||
- Distribute points on the disc with Poisson spacing controlled by thickness
|
||||
and density.
|
||||
- Instance the tapered blade on the points, scale each instance by radial
|
||||
falloff, then capture the instance `Position` on the `INSTANCE` domain.
|
||||
- Realize the instances. The captured root position survives as the center,
|
||||
radius sample, and tangent-axis basis for curl.
|
||||
- Rotate each realized blade position around a tangent axis. Curl grows along
|
||||
blade length and is modulated by distance from the tuft center.
|
||||
- Convert curled curves to mesh with a triangular profile. If a `radius`
|
||||
attribute exists, use it as the profile scale.
|
||||
|
||||
Metaphor: the disc is a nursery tray, the points are planting holes, each
|
||||
instance carries a root tag, and realization turns the tray into individual
|
||||
blades. Curl reads the root tag to bend every blade around its own base instead
|
||||
of around the world origin.
|
||||
|
||||
## Verification
|
||||
|
||||
Run:
|
||||
|
||||
```powershell
|
||||
& 'C:\Program Files (x86)\Steam\steamapps\common\Blender\blender.exe' --background '.\experiments\source-blends\blender-instance-attributes.blend' --python '.\tools\verify_instance_attributes_translations.py'
|
||||
```
|
||||
|
||||
Results from Blender 5.1.1:
|
||||
|
||||
| Case | Source vertices | Translated vertices | Delta | Status |
|
||||
| --- | ---: | ---: | ---: | --- |
|
||||
| default | 45 | 45 | 0.0 | accepted |
|
||||
| wider curlier seeded | 165 | 165 | 0.0 | accepted |
|
||||
|
||||
Both cases also match edge counts, polygon counts, and smooth-face flags.
|
||||
|
||||
## Lessons
|
||||
|
||||
- Scatter graphs often have three separable layers: seed surface, point field,
|
||||
and instance body. Keep them named in script.
|
||||
- A field can be reused across domains intentionally. Here, radial falloff
|
||||
controls both scatter density and final instance scale.
|
||||
- Captured instance attributes must be explicit under Blender 5.1. Geometry
|
||||
Script's generic `capture_attribute(...)` call did not create the required
|
||||
capture item here; the verified script uses the explicit
|
||||
`_capture_attribute_item(...)` helper.
|
||||
- `nodes_to_script` recovered the wiring and defaults well enough to debug the
|
||||
translation, but its output remains a transcript, not accepted style.
|
||||
|
|
@ -0,0 +1,67 @@
|
|||
# Translation: Blender Shortest-Path Labyrinth
|
||||
|
||||
## Source
|
||||
|
||||
- Source file:
|
||||
https://download.blender.org/demo/geometry-nodes/labyrinth-shortest_path-simon_thommes.blend
|
||||
- Source group: `Solvable Labyrinth Generator`
|
||||
- Geometry Script recreation:
|
||||
`examples/geometry_script/blender_labyrinth_shortest_path.py`
|
||||
|
||||
## Why This Graph
|
||||
|
||||
This graph is the first accepted pathfinding translation. It uses grid topology,
|
||||
randomized edge costs, shortest-edge paths, path selection, path-to-curve
|
||||
conversion, stored UV attributes, curve radius, and endpoint markers.
|
||||
|
||||
## Graph Map
|
||||
|
||||
- Build a square grid and store its UV map on the corner domain.
|
||||
- Mark vertex `0` as the path root.
|
||||
- Use edge-neighbor count and random booleans to create edge costs.
|
||||
- Run `Shortest Edge Paths`, convert the result to an edge selection, and
|
||||
capture that boolean on the edge domain.
|
||||
- Subdivide the mesh and delete selected points to carve the walkable graph.
|
||||
- Run shortest paths again on the carved graph, find the farthest X point on
|
||||
the path, and convert the edge path into curves.
|
||||
- Instance endpoint marker spheres on the path endpoints and capture their
|
||||
instance indices as `Start/End`.
|
||||
- Trim the solution curve by the exposed `Solve` value and capture a `Path`
|
||||
boolean on the curve domain.
|
||||
- Convert maze walls and solution curves into filleted radius curves, then
|
||||
convert them to mesh with a circular profile.
|
||||
- Join endpoint markers, path/wall geometry, and the base grid.
|
||||
|
||||
Metaphor: the grid is a street map, random edge costs close some roads, shortest
|
||||
path draws the route home, and the captured booleans are colored tape left on
|
||||
the roads so later carving and tube-building know what survived.
|
||||
|
||||
## Verification
|
||||
|
||||
Run:
|
||||
|
||||
```powershell
|
||||
& 'C:\Program Files (x86)\Steam\steamapps\common\Blender\blender.exe' --background '.\experiments\source-blends\blender-labyrinth-shortest-path.blend' --python '.\tools\verify_labyrinth_translations.py'
|
||||
```
|
||||
|
||||
Results from Blender 5.1.1:
|
||||
|
||||
| Case | Source vertices | Translated vertices | Delta | Status |
|
||||
| --- | ---: | ---: | ---: | --- |
|
||||
| small unsolved | 22730 | 22730 | 0.0 | accepted |
|
||||
| small solved | 25484 | 25484 | 0.0 | accepted |
|
||||
|
||||
Edge and polygon counts also match for both cases.
|
||||
|
||||
## Lessons
|
||||
|
||||
- Shortest-path graphs can be translated as topology passes first, visual
|
||||
passes second.
|
||||
- Capture path booleans before subdivision/deletion. Once the graph is carved,
|
||||
the original edge selection is no longer obvious.
|
||||
- Anonymous `Value` nodes are easy for converter output to misassign. The
|
||||
source links showed `0.1 / Size` driving radius and `3.0` driving marker
|
||||
scale; trusting the generated variable names produced the right topology at
|
||||
the wrong size.
|
||||
- Path outputs are fields. Geometry comparison catches the visible contract;
|
||||
scalar/boolean path outputs need a harness only when they become the target.
|
||||
75
docs/research/translations/blender-raycast-minigame.md
Normal file
75
docs/research/translations/blender-raycast-minigame.md
Normal file
|
|
@ -0,0 +1,75 @@
|
|||
# Translation: Blender Raycast Minigame Foothold
|
||||
|
||||
## Source
|
||||
|
||||
- Source file:
|
||||
https://download.blender.org/demo/geometry-nodes/raycast-minigame.blend
|
||||
- Source groups translated in this pass:
|
||||
- `Initial Direction`
|
||||
- `Line to be Casted`
|
||||
- `Cast Rays`
|
||||
- Geometry Script recreation:
|
||||
`examples/geometry_script/blender_raycast_minigame.py`
|
||||
|
||||
## Why This Graph
|
||||
|
||||
The full minigame graph is larger, but these helpers isolate the ray pipeline:
|
||||
make a direction, make a sampled line, cast one ray step, write the hit point
|
||||
back into the line, and return the reflected direction plus traveled distance.
|
||||
|
||||
## Helper Maps
|
||||
|
||||
`VG Initial Direction`:
|
||||
|
||||
- Start with `(1, 0, 0)` as forward.
|
||||
- Rotate it by the exposed Euler vector.
|
||||
- Output the resulting direction vector.
|
||||
|
||||
`VG Line To Be Casted`:
|
||||
|
||||
- Create a zero-length curve line.
|
||||
- Move it to `Start Pos`.
|
||||
- Resample it to `Line Size` points.
|
||||
|
||||
`VG Cast Rays`:
|
||||
|
||||
- Select the active hit point by `Hit Index`.
|
||||
- Sample the previous line point.
|
||||
- Raycast from that previous point into the target geometry along the current
|
||||
ray direction.
|
||||
- Move the active point to the hit position scaled by `0.999`.
|
||||
- Reflect the ray direction by the hit normal.
|
||||
- Add hit distance to traveled distance and increment the hit index.
|
||||
|
||||
Metaphor: the line is a breadcrumb trail. Each raycast step reads the previous
|
||||
crumb, throws a beam into the boundary object, places the next crumb just short
|
||||
of impact, then turns the beam for the next bounce.
|
||||
|
||||
## Verification
|
||||
|
||||
Run:
|
||||
|
||||
```powershell
|
||||
& 'C:\Program Files (x86)\Steam\steamapps\common\Blender\blender.exe' --background '.\experiments\source-blends\blender-raycast-minigame.blend' --python '.\tools\verify_raycast_translations.py'
|
||||
```
|
||||
|
||||
Results from Blender 5.1.1:
|
||||
|
||||
| Case | Source vertices | Translated vertices | Delta | Status |
|
||||
| --- | ---: | ---: | ---: | --- |
|
||||
| initial direction harness | 1 | 1 | 0.0 | accepted |
|
||||
| line to be casted | 5 | 5 | 0.0 | accepted |
|
||||
| cast rays | 4 | 4 | 0.0 | accepted |
|
||||
|
||||
Vector outputs are verified by geometry harnesses: direction drives a single
|
||||
vertex position, and curve outputs are converted through curve points to
|
||||
vertices before comparison.
|
||||
|
||||
## Lessons
|
||||
|
||||
- A ray pipeline is a baton chain: direction, previous point, hit, reflected
|
||||
direction, next index.
|
||||
- Object-dependent groups are better authored with explicit object inputs than
|
||||
hard-coded source object names.
|
||||
- Curve outputs may need curve-to-points harnesses before evaluated mesh
|
||||
comparison can see their control points.
|
||||
Loading…
Reference in a new issue