Nodes/ComfyUI_Antonioilev_Lightpack/πŸ’‰ Hole Surgeon (Hair Safe)
ComfyUI Node

πŸ’‰ Hole Surgeon (Hair Safe)

The fill-holes node that knows when to refuse

By AntonioilevΒ·Created 2 days agoΒ·Updated a day agoΒ· 0
πŸ’‰ Hole Surgeon (Hair Safe)
  • mesh
  • info
  • mesh
β—„hole_size_threshold0.50β–Ί
β—„max_points_in_hole60β–Ί
β—„remove_small_islandstrueβ–Ί
β—„fix_normalstrueβ–Ί
β—„relax_iterations15β–Ί

Generation doesn't lose the whole skull, it loses small patches of it. A gap behind an ear, a missing sliver along a jawline, a hole where the alpha-hair cards meet the head. Those are the wounds worth closing, and closing them badly is how people end up with a mesh whose hair has turned into a fused yellow blob.

The "hair safe" in the name is the whole feature: this node repeatedly decides not to fill things.

The mechanism

It welds vertices, optionally drops small islands (components below 5% of the largest component's area), then walks the mesh outline and inspects each boundary loop on two criteria:

  1. Vertex count. If a loop has more than max_points_in_hole points, it's skipped outright. This is the hair guard. A puncture has a handful of vertices; the outline of a hair card, a skirt fringe, or an alpha-cut region has hundreds. Default 60.
  2. Physical size. The loop's largest bounding-box dimension must be ≀ hole_size_threshold. Default 0.5 - in mesh units, so tune it to your model's scale.

Loops that pass both get a new vertex at their centroid and a triangle fan. Then - and this is the detail that makes it worth using over a generic filler - it relaxes only the newly created vertices, averaging each one toward its neighbours' mean for relax_iterations passes, leaving the original surface completely untouched. The patch settles into a smooth dimple instead of a spiky cone.

Finally it paints the result: original faces grey, new patch faces yellow, so you can look at the preview and see exactly what it did and whether it closed what you wanted. You can also read the count in the info output.

That's a materially different behaviour from the pack's Hole Filler, which relaxes the whole mesh if you ask it to and happily fans large loops.

Inputs

  • mesh - in.
  • max_points_in_hole (default 60) - the hair guard. Lower it (20–30) if it's still nibbling at hair geometry; raise it if a real hole is being ignored because its outline is complex.
  • hole_size_threshold (default 0.5) - maximum patch diameter in mesh units. Scale matters here. On a mesh normalised to about one unit tall, 0.5 is enormous and you'll be closing entire armpits. On a 100-unit Blender scene it's a pinhole. Set this consciously - it's the single parameter that decides whether this node is surgical or a bulldozer.
  • remove_small_islands (default on) - cheap pre-clean; the threshold is hard-coded at 5% of the biggest part's area, no slider.
  • relax_iterations (default 15) - how much the new centre vertices sink into the surrounding surface. 0 leaves you sharp fans; 15 is smooth; 50 makes the patch a flat lid.
  • fix_normals (default on) - fixes winding after patching. Leave it on.

Outputs: info (STRING - first slot) and mesh (second slot). The info text is unusually friendly: Success! Closed 47 small holes. Head preserved by vertex count limit. or Nothing closed. Try to adjust 'max_points_in_hole' or 'hole_size_threshold'. Believe the second one - it means the guards did their job, and you should change the thresholds rather than assume the node is broken.

The thing to know before you colour anything

Setting face colours replaces the mesh's visual block. If the mesh carried UVs and a texture material, or vertex colours you set with Mesh Colorizer, expect the yellow/grey patch colouring to take over. Do hole repair before colouring and texturing, or accept that you're re-applying them after.

Install

cd ComfyUI/custom_nodes
git clone https://github.com/Antonioilev/ComfyUI_Antonioilev_Lightpack.git
python -m pip install trimesh

Restart. Manager can clone the pack (search Antonioilev Light Pack) but it can't resolve dependencies for it, because the repo contains no requirements.txt and no install.py - everything the mesh nodes import is on you. This one only needs trimesh plus what ships with ComfyUI. After restarting, the pack prints [Antonioilev_Light_pack] Loaded N nodes (M failed); if HoleSurgeon appears in that failure list, the missing module is named right there.

Order it as: Clean Mesh β†’ Hole Surgeon β†’ Mesh Fixer Fast β†’ Refine Mesh β†’ colour β†’ export. Small punctures first, then the structural repair, then smoothing, then paint. Reverse any two of those and you're repairing geometry you already decorated.

CategoryAntonioilev/Mesh/Fix

Inputs (6)

NameTypeDefaultDescription
meshTRIMESHβ€”
hole_size_thresholdFLOAT0.500.001–10β€”
max_points_in_holeINT603–1000β€”
remove_small_islandsBOOLEANtrueβ€”
fix_normalsBOOLEANtrueβ€”
relax_iterationsINT150–50β€”

Outputs (2)

NameTypeDescription
infoSTRINGβ€”
meshTRIMESHβ€”