Nodes/ComfyUI libigl/Decimate Quadric Edge Collapse (backend)
ComfyUI Node

Decimate Quadric Edge Collapse (backend)

Collapse edges, keep the shape honest

By PozzettiAndrea·Created 10 months ago·Updated 4 days ago· 218
Decimate Quadric Edge Collapse (backend)
  • trimesh
  • decimated_mesh
  • info
target_face_count5000
quality_threshold0.30
preserve_boundarytrue
preserve_normaltrue
preserve_topologytrue
planar_quadricfalse

Quadric edge collapse is the workhorse of mesh reduction - the algorithm that most "deciimate this" buttons in serious tools are built on. It works by repeatedly collapsing edges, and for each candidate collapse it computes a quadric error, a mathematical estimate of how much shape you'd lose. Cheap collapses (flat regions) happen first, expensive ones (curved, detailed areas) happen last, and the result is that the shape stays honest while the face count drops. This node is the Quadric Edge Collapse backend of the pack's Decimate family, exposed directly for when you want the surgical version rather than the all-in-one.

You feed it a TRIMESH and set a target; you get decimated_mesh plus an info string with the result stats.

  • target_face_count - how many faces you want at the end. This is the control; everything else is about making sure the reduction doesn't wreck the mesh.
  • quality_threshold - how conservative the collapse is about triangle quality. Higher = fewer aggressive collapses, better-shaped triangles, but you may not hit your target count as cleanly. 0.3 is a fine default; raise it if the output triangles look like spaghetti.
  • preserve_boundary - don't collapse the open edges of the mesh. Off for boundary meshes, because a decimator that eats its own borders produces a frayed result.
  • preserve_normal - stop collapses that would flip a face's normal. This is your shield against the "surface suddenly points the wrong way" artifact, and it's the one to keep on.
  • preserve_topology - keep the mesh's genus (holes, handles) intact.
  • planar_quadric - add a penalty for non-planar faces, which helps keep flat regions flat. If you're decimating a CAD-like or architectural mesh, this is the checkbox that saves you.

Where it fits

This is the decimator you reach for when quality matters more than speed or simplicity. The setup that pays off: fix the mesh first (quadric collapse is sensitive to winding and degenerate faces - preserve_normal only helps if the input normals are sane to begin with), then decimate in stages if you're going very aggressive, checking the info output between passes. A 99% collapse in one shot is a bet; two 90% passes are a plan.

Install

Part of the pack:

cd ComfyUI/custom_nodes
git clone https://github.com/PozzettiAndrea/ComfyUI-GeometryPack.git
cd ComfyUI-GeometryPack
pip install -r requirements.txt --upgrade
python install.py

Or ComfyUI Manager → search GeometryPack. README caveats: the install is the experimental comfy-env/pixi path with a big first download, and the repo is under fast development with the author collecting reports in Discussions.

The honest take

Quadric collapse is the right default for most "make this smaller" jobs, but it has a known bias: it protects shape at the expense of features. Small but important details - a thin fin, a subtle ridge - can vanish because their quadric error is low relative to the whole. If you're decimating a mesh with meaningful small features, check the result against the original rather than trusting the error metric. And when you're near a target that the mesh won't reach cleanly, adjust target_face_count or the quality threshold instead of forcing it - the decimator can't invent triangles.

Categorygeompack/decimation

Inputs (7)

NameTypeDefaultDescription
trimeshTRIMESH
target_face_countINT50004–10000000Target number of output faces.
quality_thresholdFLOAT0.300–1Quality threshold for edge collapse. Higher = more conservative, better triangle quality.
preserve_boundaryCOMBOtruePreserve mesh boundary edges during decimation.
preserve_normalCOMBOtruePrevent face normal flips during decimation.
preserve_topologyCOMBOtruePreserve mesh topology (genus) during decimation.
planar_quadricCOMBOfalseAdd penalty for non-planar faces. Helps preserve flat regions.

Outputs (2)

NameTypeDescription
decimated_meshTRIMESH
infoSTRING