Skip to content

Commit e4bb0ca

Browse files
committed
fix: mesh SDF grids with GridToMesh, not VolumeToMesh, in GN example
build_remesh_via_sdf wired MeshToSDFGrid's 'SDF Grid' output (a grid/float socket) into VolumeToMesh's 'Volume' input (a geometry socket). That link is is_valid=False, so VolumeToMesh received no data and the evaluated modifier produced 0 vertices on both 4.5.10 LTS and 5.1.1, at every Voxel Size/Band Width/Threshold combination tried. Root cause: VolumeToMesh meshes a volume geometry (as produced by MeshToVolume), not a bare grid. Switched to GeometryNodeGridToMesh (Grid input is type-compatible) with threshold=0.0 (SDF zero-level). Verified: cube remesh now yields 10088 verts (5.1.1) / 9602 (4.5.10), zrange (-1.0, 1.0). Updated the heading and node-reference table accordingly. Signed-off-by: fOuttaMyPaint <TMhospitalitystrategies@gmail.com>
1 parent bb8df75 commit e4bb0ca

1 file changed

Lines changed: 15 additions & 8 deletions

File tree

skills/geometry-nodes-python/SKILL.md

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,8 @@ The argument is the exact RNA `bl_idname` of the node class. A few you'll reach
155155
| Mix | `ShaderNodeMix` |
156156
| Noise Texture | `ShaderNodeTexNoise` |
157157
| Mesh to SDF Grid (4.3+) | `GeometryNodeMeshToSDFGrid` |
158-
| SDF Grid to Mesh / Volume to Mesh | `GeometryNodeVolumeToMesh` |
158+
| Grid to Mesh (meshes an SDF/grid) | `GeometryNodeGridToMesh` |
159+
| Volume to Mesh (meshes a volume geometry) | `GeometryNodeVolumeToMesh` |
159160
| Repeat Input / Output | `GeometryNodeRepeatInput`, `GeometryNodeRepeatOutput` |
160161
| For Each Element Input / Output (4.3+) | `GeometryNodeForeachGeometryElementInput`, `GeometryNodeForeachGeometryElementOutput` |
161162

@@ -274,13 +275,19 @@ def has_for_each_element():
274275

275276
6. **Building the tree without group input/output nodes**. The tree's interface sockets only matter once you have `NodeGroupInput` and `NodeGroupOutput` instances connected to actual nodes inside the tree.
276277

277-
## Worked example: replicate the "Mesh to SDF then Volume to Mesh" pipeline
278+
## Worked example: replicate the "Mesh to SDF then Grid to Mesh" pipeline
279+
280+
An SDF grid is meshed with **Grid to Mesh** (`GeometryNodeGridToMesh`), not **Volume to
281+
Mesh**. The `Mesh to SDF Grid` output is a *grid* socket; `Volume to Mesh` takes a *volume
282+
geometry* socket (what `Mesh to Volume` produces), so wiring the SDF grid into it is an
283+
invalid connection that silently yields no geometry. `Grid to Mesh` has the matching grid
284+
input. For an SDF the surface is at distance 0, so use `threshold=0.0`.
278285

279286
```python
280287
import bpy
281288

282289

283-
def build_remesh_via_sdf(voxel_size=0.05, threshold=0.5):
290+
def build_remesh_via_sdf(voxel_size=0.05, threshold=0.0):
284291
tree = bpy.data.node_groups.new(name="SDFRemesh", type='GeometryNodeTree')
285292

286293
tree.interface.new_socket(name="Geometry", in_out='INPUT', socket_type='NodeSocketGeometry')
@@ -289,19 +296,19 @@ def build_remesh_via_sdf(voxel_size=0.05, threshold=0.5):
289296
grp_in = tree.nodes.new('NodeGroupInput')
290297
grp_out = tree.nodes.new('NodeGroupOutput')
291298
mesh_to_sdf = tree.nodes.new('GeometryNodeMeshToSDFGrid')
292-
volume_to_mesh = tree.nodes.new('GeometryNodeVolumeToMesh')
299+
grid_to_mesh = tree.nodes.new('GeometryNodeGridToMesh')
293300

294301
mesh_to_sdf.inputs["Voxel Size"].default_value = voxel_size
295-
volume_to_mesh.inputs["Threshold"].default_value = threshold
302+
grid_to_mesh.inputs["Threshold"].default_value = threshold # isosurface at the SDF zero-level
296303

297304
grp_in.location = (-400, 0)
298305
mesh_to_sdf.location = (-150, 0)
299-
volume_to_mesh.location = (150, 0)
306+
grid_to_mesh.location = (150, 0)
300307
grp_out.location = (400, 0)
301308

302309
tree.links.new(grp_in.outputs["Geometry"], mesh_to_sdf.inputs["Mesh"])
303-
tree.links.new(mesh_to_sdf.outputs["SDF Grid"], volume_to_mesh.inputs["Volume"])
304-
tree.links.new(volume_to_mesh.outputs["Mesh"], grp_out.inputs["Geometry"])
310+
tree.links.new(mesh_to_sdf.outputs["SDF Grid"], grid_to_mesh.inputs["Grid"])
311+
tree.links.new(grid_to_mesh.outputs["Mesh"], grp_out.inputs["Geometry"])
305312

306313
return tree
307314
```

0 commit comments

Comments
 (0)