ComfyUI Node

Save Trimesh

Saving Your Hunyuan3D Mesh as GLB, OBJ, STL, or Whatever

By UnlimitedEditing·Created 3 months ago·Updated 12 days ago· 0
Save Trimesh
  • trimesh
  • file_path
  • also_path
filename_prefix3D/Hunyuan3D
file_format
also_savenone
save_filetrue

Every image-to-3D workflow ends the same way: with a file on disk you can actually hand to something else. ComfyUI's native 3D nodes have a SaveGLB, but this pack's pipeline works on trimesh objects, so it needs its own exporter - and Hy3DSaveTrimesh is it. It writes a TRIMESH to one of six formats (GLB, OBJ, PLY, STL, 3MF, DAE) and, usefully, can write a second format at the same time, so you can save a GLB for viewing in Blender and an STL for the slicer in one pass. If you're printing what Hunyuan3D made - which, per the community consensus, is one of the few genuinely production-ready uses for these models - this is the node that gets the file into your slicer.

How it works

It reuses ComfyUI's own image-saving machinery, which is smart. It calls folder_paths.get_save_image_path() with your prefix, so files land in the standard output/ folder (or the temp folder - more on that below) and get the familiar collision-safe numbering: Hunyuan3D_00001_.glb, Hunyuan3D_00002_.glb, and so on. Each format is written with trimesh's own export() call, which handles the conversion. The node is marked as an output node, so its file_path string output doubles as the "I'm done" signal that tells ComfyUI to show the batch as complete.

The inputs that matter

  • trimesh (required): the mesh to export - typically the UV-unwrapped output of Hy3DUVUnwrapMesh, though it'll happily save any trimesh.
  • filename_prefix (required): defaults to 3D/Hunyuan3D, which means the 3D subfolder inside output/. Change it to 3D/myCharacter to keep runs separated.
  • file_format (required): pick one of glb, obj, ply, stl, 3mf, dae.
  • also_save (optional): a second format, or none. This is the "print a copy for the slicer" knob.
  • save_file (optional): defaults to true. The toggle label spells it out - output vs temp. True writes to output/; false writes to ComfyUI's temp directory, which is handy when you're exporting as an intermediate step and don't want it cluttering your outputs.

The two STRING outputs are file_path (the primary file, relative to the output folder) and also_path (the second file, or an empty string if you didn't use also_save).

Installing it

Same as every node in the pack: ComfyUI Manager, search "ComfyUI-Hunyuan3D", or:

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

restart, and make sure trimesh installed (it's in the pack's requirements.txt alongside xatlas and requests). Like the other mesh nodes, it only registers if trimesh is importable - if it's missing from the menu, that's your dependency install, not a config option.

Common issues

Two things trip people up. First, the returned file_path is a relative path, not absolute - if you're scripting around it, join it with ComfyUI's output directory yourself; the node prints the absolute path to the console if you want confirmation. Second, the also_save write is silently skipped if it matches file_format (no point writing the same file twice). And a real-world note: if you're exporting for texturing, the GLB you get out is only as good as the UVs you put in - export the unwrapped trimesh, not the raw one, or you'll be redoing the whole loop.

CategoryHunyuan3D

Inputs (5)

NameTypeDefaultDescription
trimeshTRIMESH
filename_prefixSTRING3D/Hunyuan3D
file_formatCOMBO6 options: glb, obj, ply, stl, 3mf, dae
also_saveoptCOMBOnone7 options: none, glb, obj, ply, stl, 3mf, +1
save_fileoptBOOLEANtrue

Outputs (2)

NameTypeDescription
file_pathSTRING
also_pathSTRING