Nodes/ComfyUI-Hunyuan3d-2-1/Hunyuan 3D 2.1 Post Process Trimesh
ComfyUI Node

Hunyuan 3D 2.1 Post Process Trimesh

The cleanup crew — turn the decoder's raw triangle soup into something usable

By visualbruno·Created about a year ago·Updated 5 days ago· 375
Hunyuan 3D 2.1 Post Process Trimesh
  • trimesh
  • trimesh
remove_floaterstrue
remove_degenerate_facestrue
reduce_facestrue
max_facenum40000
smooth_normalsfalse

The mesh that comes out of Hy3D21VAEDecode is raw. Marching cubes doesn't care about floating garbage, zero-area triangles, or a face count that'll melt your UV unwrapper - it just produces geometry. Hy3D21PostprocessMesh is the node that cleans all that up before you do anything downstream with it. In every mesh-generation workflow, it sits right after the VAE decode and before Hy3D21MeshUVWrap, and skipping it is a great way to make every later step slower and uglier.

How it works

It runs the mesh through the pack's hy3dshape postprocessors, one toggle at a time:

  • remove_floaters (default true) - FloaterRemover, which deletes disconnected bits of surface that float free of the main body. The decoder loves to spawn these.
  • remove_degenerate_faces (default true) - DegenerateFaceRemover, which kills zero-area and collapsed triangles that wreck UV mapping and decimation.
  • reduce_faces (default true) - FaceReducer, which brings the triangle count down to max_facenum (default 40,000). This is the big one: the decoder can emit hundreds of thousands of faces, and 40k is a sane working count for texturing and unwrapping.
  • smooth_normals (default false) - recomputes vertex normals via trimesh.smoothing. Off by default because it can soften detail; flip it on if your preview looks faceted.

The inputs that matter

The one you'll actually touch is max_facenum. Lower it (say 10–20k) for a lighter mesh that unwraps and bakes fast, especially if you're decimating further later anyway. Raise it if you're chasing detail and have the RAM. The four booleans are all safe to leave at their defaults - the pack's defaults are the tested behavior.

Why it's worth running

Raw decoder output has floaters that will show up as random shards in your final export, degenerate faces that make xatlas UV wrapping slow or crashy, and a face count that makes every bake step memory-hungry. Ten seconds of this node saves you a headache that's hard to diagnose later, because the failure appears downstream in unrelated nodes. It's the cheapest insurance in the whole pack.

Installing it

Standard pack install - the postprocessors live inside the pack's vendored hy3dshape code, so nothing extra is needed beyond the base:

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

Common issues

If your cleaned mesh looks thinner or loses detail you liked, you over-reduced - check max_facenum. If floaters survive, the remover has a size heuristic and tiny specks can get through; nudge the mesh through Hy3D21MeshlibDecimate instead. And if the node errors on a mesh from another pack, it's expecting a real TRIMESH with proper arrays - garbage in, garbage out. Feed it clean geometry and it behaves.

CategoryHunyuan3D21Wrapper

Inputs (6)

NameTypeDefaultDescription
trimeshTRIMESH
remove_floatersBOOLEANtrue
remove_degenerate_facesBOOLEANtrue
reduce_facesBOOLEANtrue
max_facenumINT400001–10000000
smooth_normalsBOOLEANfalse

Outputs (1)

NameTypeDescription
trimeshTRIMESH