Nodes/ComfyUI libigl/Sharpen L0 Minimize (backend)
ComfyUI Node

Sharpen L0 Minimize (backend)

Flatten a mesh into clean CAD plates

By PozzettiAndrea·Created 10 months ago·Updated 4 days ago· 218
Sharpen L0 Minimize (backend)
  • trimesh
  • sharpened_mesh
  • info
alpha0.0010
beta2.0
iterations10

Some meshes don't need sharpening so much as an attitude adjustment. Your generative 3D output is lumpy where it should be flat - the face of a housing, the side of a panel, anything that's supposed to be a plane. L0 minimization is the node that turns "roughly flat, actually bumpy" into "flat, with defined creases between regions." It's the most aggressive tool in the GeometryPack sharpen family, and it's brilliant for CAD prep.

It's a backend node under Sharpen Mesh (select l0_minimize in the dropdown), or searchable directly as "Sharpen L0 Minimize (backend)".

How it works

The mechanism comes from L0 optimization, a family of techniques for promoting piecewise-flat solutions. Instead of smoothing everything uniformly, the algorithm treats small differences between adjacent face normals as noise and snaps them to zero - but only once the difference falls below a threshold. Edges that exceed the threshold survive as genuine creases. Iterate that, raising the threshold each round, and you converge on a surface made of flat patches separated by clean lines.

Three inputs drive it:

  • alpha (default 0.001, 0.0001–0.1) - the initial regularization weight, i.e. where the snapping threshold starts. Smaller = gentler start. Leave it small unless you want immediate, aggressive flattening.
  • beta (default 2, 1.1–10) - how fast alpha grows each iteration; it's multiplied by beta per step. 2.0 doubles every pass. Higher beta means faster convergence toward piecewise-flat, but overshoot is easier.
  • iterations (default 10, 1–50) - how many optimization rounds. The threshold climbs every step, snapping more normals flat each time.

The info STRING output is worth a glance here, because this node can silently over-do it - if your mesh comes back looking "steppy" or faceted in places you wanted curved, you either over-iterated or pushed beta too high.

Inputs and outputs

Input is just trimesh plus those three sliders. Outputs are sharpened_mesh (TRIMESH) for the next node and info (STRING) for diagnostics.

When to use it

Reach for L0 when the target is genuinely flat surfaces: reverse-engineered CAD parts, hard-surface props destined for a texture bake, anything heading toward a 3D printer or an engineering package. Don't reach for it on organic shapes - it will happily turn a face into a polyhedron. For softer cleanup, two_step or libigl_unsharp are friendlier.

Install is the pack standard: ComfyUI Manager search "GeometryPack", or git clone https://github.com/PozzettiAndrea/ComfyUI-GeometryPack into custom_nodes/, pip install -r requirements.txt --upgrade, python install.py, restart. The experimental comfy-env/pixi installer does the heavy lifting; give the first run time to finish.

Categorygeompack/smoothing

Inputs (4)

NameTypeDefaultDescription
trimeshTRIMESH
alphaFLOAT0.00100.0001–0.1Initial regularization weight for L0 minimization. Controls the threshold below which normal differences are snapped to zero. Smaller = gentler start, larger = more aggressive initial flattening.
betaFLOAT2.01.1–10Growth rate for alpha each iteration. Alpha is multiplied by beta each step. 2.0 doubles per iteration. Higher = faster convergence to piecewise-flat.
iterationsINT101–50Number of L0 optimization iterations. The algorithm gradually increases the threshold, snapping more normals flat each step.

Outputs (2)

NameTypeDescription
sharpened_meshTRIMESH
infoSTRING