Sharpen L0 Minimize (backend)
Flatten a mesh into clean CAD plates
- trimesh
- sharpened_mesh
- info
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 fastalphagrows each iteration; it's multiplied bybetaper 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.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| trimesh | TRIMESH | — | |
| alpha | FLOAT | 0.00100.0001–0.1 | Initial regularization weight for L0 minimization. Controls the threshold below which normal differences are snapped to zero. Smaller = gentler start, larger = more aggressive initial flattening. |
| beta | FLOAT | 2.01.1–10 | Growth rate for alpha each iteration. Alpha is multiplied by beta each step. 2.0 doubles per iteration. Higher = faster convergence to piecewise-flat. |
| iterations | INT | 101–50 | Number of L0 optimization iterations. The algorithm gradually increases the threshold, snapping more normals flat each step. |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| sharpened_mesh | TRIMESH | — |
| info | STRING | — |