Nodes/ComfyUI-Hunyuan3D/Mesh to Trimesh
ComfyUI Node

Mesh to Trimesh

The Bridge Node That Turns ComfyUI's MESH Into a Trimesh

By UnlimitedEditing·Created 3 months ago·Updated 12 days ago· 0
Mesh to Trimesh
  • mesh
  • TRIMESH

This is the least glamorous node in the ComfyUI-Hunyuan3D pack and the one the whole pipeline depends on. ComfyUI's native Hunyuan3D workflow ends with VoxelToMesh, which emits a MESH object - ComfyUI's own internal representation of vertices and faces. That socket type is great inside ComfyUI but useless for doing actual geometry work, because everything useful you might want to do next (UV unwrap, texture baking, exporting) needs a real mesh library. Hy3DMeshToTrimesh converts one to the other. It's a one-line shim, and it's exactly what the pack needs.

The target format, trimesh, is the Python library that does this job across the whole ecosystem - geometry operations, UVs, and export to every file format you'd want. So the trade is simple: hand this node the MESH output of VoxelToMesh, and you walk away with a TRIMESH that the pack's UV Unwrap Mesh and Save Trimesh nodes can consume.

How it works

The implementation is almost insultingly direct:

Trimesh.Trimesh(mesh.vertices[0], mesh.faces[0])

It takes the first entry of the mesh's vertex and face arrays, hands them to trimesh's constructor, and returns a trimesh.Trimesh object where vertices and faces are numpy arrays. That's it. No cleanup, no retriangulation, no deduplication - you get the geometry exactly as Hunyuan3D's voxel extraction produced it, which is worth remembering, because that geometry is triangle soup. Nothing in this node makes it prettier.

Inputs and outputs

  • mesh (required): the MESH socket output by ComfyUI's native VoxelToMesh node.
  • TRIMESH (output): a trimesh object with vertices and faces as numpy arrays.

That's the entire surface area - no options, no toggles. If the node is missing from your menu, scroll down to the install section, because that's usually the cause.

Installing it

Via ComfyUI Manager, search "ComfyUI-Hunyuan3D". Manually:

cd ComfyUI/custom_nodes
git clone https://github.com/UnlimitedEditing/ComfyUI-Hunyuan3D

then restart ComfyUI and install the requirements if Manager didn't: the requirements.txt is just trimesh, xatlas, and requests. Here's the gotcha specific to this node: the pack registers Mesh to Trimesh, UV Unwrap Mesh, and Save Trimesh only if trimesh imports successfully - and it needs comfy_extras.nodes_hunyuan3d to export the MESH type, which means you also need ComfyUI recent enough to ship the native Hunyuan3D support. If you install the pack and only see "Load Image From URL (Hunyuan3D)" in the menu, this node silently didn't register. Fix: make sure pip install trimesh actually worked in ComfyUI's Python, then restart. The pack was built to complement ComfyUI's native Hunyuan3D-2 nodes - you don't need the heavyweight ComfyUI-3D-Pack for any of this.

Where it sits

The full flow reads like a parts list: VoxelToMesh → Hy3DMeshToTrimesh → Hy3DUVUnwrapMesh → Hy3DSaveTrimesh. Nothing about the shape changes here; this node exists so the geometry can leave ComfyUI's socket world and enter a library where the next two nodes can actually operate on it.

CategoryHunyuan3D

Inputs (1)

NameTypeDefaultDescription
meshMESH

Outputs (1)

NameTypeDescription
TRIMESHTRIMESHTRIMESH object containing vertices and faces as numpy arrays.