Ben Traje
← Back to modelling

Houdini Quick Tips: Deleting Faces Based on Direction with VEX & Fixing Boolean Caps

08 Sep 26 (1mo ago)

Deleting Faces Based on Direction

When you need to delete a specific side of a mesh facing a target, using a dot product in an Attribute Wrangle (Run Over: Primitives) is much faster and more reliable than raycasting. It compares the polygon normal against a target direction and gives you a smooth 0-to-1 range to threshold.

Here is the VEX snippet to delete faces pointing towards a specific direction using a slider:

// Create a slider for your target direction (e.g., straight up is 0, 1, 0)
vector dir = normalize(chv("direction"));

// Calculate how much the normal faces that direction
float facing_ratio = dot(@N, dir);

// Slider to control the cutoff threshold
float threshold = chf("threshold");

// Delete if the facing ratio is greater than the threshold
if (facing_ratio > threshold) {
    removeprim(0, @primnum, 1);
}

Cleaning Up Stray Pieces

After hacking away at a mesh, you often end up with floating garbage geometry.

  • The easy way: Drop down a Labs Delete Small Parts SOP, uncheck "Extract as Points," and adjust the threshold slider.
  • The vanilla way: Use a Connectivity SOP to assign piece IDs, a Measure SOP to calculate face area, and an Attribute Promote SOP (set to Sum) to calculate the total area per piece. Then blast anything under your size threshold.

Slicing and Capping Geometry

If you just need a flat bottom on a mesh, the Clip SOP is the fastest slicer, but it leaves the geometry open. Wire the result straight into a PolyFill SOP (set to Single Polygon) to cap the hole.

Why is Boolean Failing to Cap?

If you are using a Boolean SOP (Subtract) and it leaves an open hole instead of a solid cap, your inputs are not mathematically watertight.

  • Shell Geometry: Boolean cannot cap an open surface. Add a PolyExtrude SOP (with "Output Back" checked) to give your mesh real thickness before the cut.
  • Unfused Seams: Drop a Fuse SOP on both inputs to weld microscopic gaps.
  • Flipped Normals: Ensure polygon normals face outward. Use a Reverse SOP if they point inside.
  • Bad Math: Run a Clean SOP to strip out overlapping or non-manifold primitives.

What specific Houdini project are you currently building this setup for?