Nodes/ComfyUI libigl/Extract Largest Component
ComfyUI Node

Extract Largest Component

Mesh fell apart into islands? Grab the main body and move on

By PozzettiAndrea·Created 10 months ago·Updated 4 days ago· 218
Extract Largest Component
  • trimesh
  • trimesh
  • info

Load a mesh from a scanner, a generator, or a half-cleaned export and you often get more than you bargained for: the object you want plus a cloud of floating debris - stray triangles, disconnected fragments, little islands of geometry orbiting the main body. Extract Largest Component is the cleanup that keeps the piece you care about and discards the rest. It does exactly what the name says: finds the largest connected component of the mesh and hands it to you separately.

Connected components, in mesh terms, are the groups of faces that actually touch each other - share edges, form one continuous surface. The main body is nearly always the biggest one; everything else is usually junk. This node computes the components and splits them out, so you can take the largest and stop worrying about the debris contaminating a boolean, a decimate, or an export.

The inputs and outputs

  • trimesh - one mesh in.
  • trimesh (output) - a list, containing the separated components (largest plus the rest), so you can inspect them side by side or grab just the one you need.
  • info - a STRING report: how many components, how big each one is relative to the whole. That's your cue for what got thrown out.

Installing it

Standard install for the whole 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

Restart ComfyUI. ComfyUI Manager also works - search "GeometryPack" or install via Git URL with https://github.com/PozzettiAndrea/ComfyUI-GeometryPack.git. The one-click installer is experimental and pulls in pixi; the README's manual route is the reliable one.

When it saves your day - and when it doesn't

This is the node you want after anything that shatters a mesh: a boolean that scattered fragments, a cleanup that popped off pieces, a scan with noise floating around the real object. It's also the standard pre-step before decimation or UV unwrapping, because both of those behave better on one contiguous piece than on a bag of islands. The honest limitation: "largest component" is a heuristic, not a guarantee. If your mesh is a pile of disconnected parts where the one you actually want is not the biggest - say, a small prop you care about floating next to a huge accidental slab - this node will keep the wrong thing. Read the info string before you trust the result, and if the mesh is meant to have many separate pieces, don't extract - just merge them. Like the rest of this pack it's young and fast-moving, so update it if anything errors on load.

Categorygeompack/analysis

Inputs (1)

NameTypeDefaultDescription
trimeshTRIMESH

Outputs (2)

NameTypeDescription
trimeshTRIMESH
infoSTRING