Line Wrangling in Houdini: Managing Edges for Procedural 3D Printing
05 Jul 26 (4d ago)
I’ve been exploring procedural modeling lately specifically geared toward 3D printing. In the past, I've used procedural workflows for level creation—which mostly boils down to scattering points and instancing modular assets. That workflow has its complexities, but it's relatively straightforward.
When generating procedural models for 3D printing, especially when dialing in a watertight mesh for standard materials like PLA or PETG, you have to pay strict attention to your lines. If you aren't completely familiar with Houdini's architecture, lines (or edges) aren't quite "first-class citizens" compared to other components.
For example, you don't get a dedicated "Edge Attribute Wrangle." When you middle-click a node for the geometry spreadsheet summary, you won't see an edge/line component count either. For all intents and purposes, Houdini treats a standalone line segment as a Primitive (specifically, a polyline).
This architectural quirk threw me off guard when I was initially trying to build solid primitives by connecting lines. To save my future self from the headache, here are some core principles and workflows.
Converting Geometry to Lines
If you want to extract the wireframe from an existing piece of geometry—say, a standard 1x1 grid—you can simply drop down a Convert Line SOP.
Here is what happens under the hood:
- Before: A 1x1 grid consists of 4 points, 4 vertices, and 1 polygon primitive.
- After Convert Line: You will now have 4 points, 8 vertices, and 4 line primitives.
During this process, Houdini deletes all the underlying faces, leaving you with just the structural wireframe.
Rebuilding Faces from Lines
If you need to turn those loose points and lines back into solid faces, you have to jump through a few hoops.
- The PolyPath Node: First, add a
PolypathSOP. This effectively reverses theConvert Lineeffect by connecting the loose, unshared edges into continuous paths. However, you still won't have any faces yet. - The PolyFill Node: Next, append a
PolyfillSOP to generate faces inside those paths.
Are we done? Not quite. After the Polyfill, you will successfully have your new polygon faces, but the original line primitives will still exist. You now have overlapping data: one primitive for the polygon face, and several primitives for the boundary lines.
How to clean it up:
In the Polyfill node parameters, enable Patch Group. Then, drop down a Blast node and isolate/delete everything except that new patch group.
Building Lines from Scratch with Points
What if you aren't starting with existing geometry, but just a cloud of points?
If you are starting from points and need to generate lines between them, you can connect them using the good old Add SOP. Navigate to the Polygons tab, select By Pattern, and type in the specific point numbers in the order you want them connected.
Alternatively, if you prefer writing code, you can drop down a Detail Wrangle and manually join points using VEX. It looks something like this:
// Connecting specific points to create polyline primitives
addprim(0, "polyline", 0, 2);
addprim(0, "polyline", 1, 3);
addprim(0, "polyline", 3, 2);
addprim(0, "polyline", 1, 0);
Once those lines are generated, you can feed them straight into the Polypath > Polyfill workflow mentioned above to generate solid, printable geometry.