Nodes/ComfyUI-Hunyuan3d-2-1/Hunyuan 3D 2.1 Simple Meshlib Decimation
ComfyUI Node

Hunyuan 3D 2.1 Simple Meshlib Decimation

The decimator that doesn't ask 20 questions — just pick a target and go

By visualbruno·Created about a year ago·Updated 5 days ago· 375
Hunyuan 3D 2.1 Simple Meshlib Decimation
  • trimesh
  • trimesh
subdivideParts16
target_face_num
target_face_ratio

Hy3D21MeshlibDecimate exposes every knob MeshLib has. Hy3D21SimpleMeshlibDecimate is the version that realized nobody needs all of them. Same engine, same MeshLib decimation underneath, but the interface is cut down to three inputs: the mesh, subdivideParts (default 16 - set to your core count), and your choice of target_face_num or target_face_ratio. That's the whole node, and it's genuinely the one most people should be using.

How it works

Exactly like its big sibling, minus the options: build a DecimateSettings, set maxDeletedFaces from either the absolute target or the ratio, packMesh = True, run the pack's postprocessmesh, return the reduced TRIMESH. You must set one of the two targets - both at 0 raises target_face_num or target_face_ratio must be set. If the target is already bigger than the current mesh, it returns the input unchanged rather than exploding.

Which of the two targets?

  • target_face_num - "I want a 40k-triangle mesh." Precise, easy to reason about, and it's what you'll use when you know your destination (game engines and 3D-print slicers both have hard budgets).
  • target_face_ratio - "cut it to 30% of what it is." Handy when you don't know the starting count and just want a quick LOD ladder.

Where it fits

Use it right after Hy3D21PostprocessMesh to shrink a decoded mesh before UV wrapping (fewer faces = happier xatlas = faster bakes), or as the final simplification before Hy3D21ExportMesh when your target format has a budget. If the result has visible artifacts and you need to argue with the decimator about it, step up to the full Hy3D21MeshlibDecimate and its strategy/maxError controls - but 90% of the time, "set a target, accept the result" is the right workflow.

Installing it

Requires meshlib, which is in the pack's requirements.txt, so a stock install covers it:

cd ComfyUI/custom_nodes
git clone https://github.com/visualbruno/ComfyUI-Hunyuan3d-2-1
cd ComfyUI-Hunyuan3d-2-1
pip install -r requirements.txt

Missed it? pip install meshlib will fix the "meshlib not found" error this node throws on import.

Common issues

The main one is texture loss: MeshLib decimation here is geometry-only. If your mesh has vertex colors or a texture and you decimate it, those don't survive. For texture-preserving LOD work, use the pack's HighPoly to LowPoly Bake MultiViews With MetaData node, which decimates and re-bakes the texture onto each LOD. And remember subdivideParts isn't a quality setting - it's parallelism; set it to your CPU core count and leave it.

CategoryHunyuan3D21Wrapper

Inputs (4)

NameTypeDefaultDescription
trimeshTRIMESH
subdividePartsINT161–64Should be the number of CPU/Core
target_face_numoptINT0–10000000
target_face_ratiooptFLOAT0–0.999

Outputs (1)

NameTypeDescription
trimeshTRIMESH