Nodes/ComfyUI-AutoFlow/Export Textured Mesh
ComfyUI Node

Export Textured Mesh

Export Hunyuan3D meshes with textures that survive Blender

By ZXL-Xinram·Created about a year ago·Updated 9 months ago· 4
Export Textured Mesh
  • trimesh
  • albedo_texture
  • mr_texture
  • normal_texture
  • mesh_path
  • albedo_path
  • mr_path
  • normal_path
filename_prefix3D/textured_model
file_format
save_filetrue

3D in ComfyUI is still mostly a Hunyuan3D story, and the pain point everyone hits is the last step: you generated a mesh and a texture, and exporting something that actually opens correctly in Blender - with materials, not as a gray lump - is fiddly. Export Textured Mesh is that last step, written to reuse Hunyuan3D's own export logic so normals and PBR materials come out right.

It takes a TRIMESH (the mesh object type from the Hunyuan3D wrapper packs) plus up to three textures and writes either a GLB with embedded PBR materials or an OBJ + MTL + texture files.

How it works

For GLB it goes: export the mesh to OBJ (which preserves the original normals), write the textures out to a temp folder, then use pygltflib to build a proper glTF with PBR materials - albedo as base color, metallic/roughness packed into the right channels (metallic in B, roughness in G), all embedded as base64 data URIs so the .glb is self-contained. For OBJ it writes the mesh, the texture PNGs, and a hand-written MTL file, then patches the OBJ to reference it.

The trap to know about first

The source file has a warning that the author clearly learned the hard way, and it's the single most important thing about this node: leave normal_texture empty. The Hunyuan3D MultiViews Generator's "normals" output is a multi-view normal map, not a usable normal texture for export. If you connect it, you'll get shading artifacts in Blender that are a nightmare to debug. Don't wire that output into this node just because the name matches.

Inputs and outputs

  • trimesh - required, TRIMESH type. This can only come from a Hunyuan3D wrapper pipeline; this node creates nothing itself. If you don't have the wrapper installed, the input type won't even exist.
  • albedo_texture / mr_texture - optional IMAGE tensors. mr is assumed to be metallic-in-blue, roughness-in-green and gets split accordingly.
  • file_format - glb or obj.
  • filename_prefix - default 3D/textured_model, saved under ComfyUI/output/3D/.
  • save_file - flip off to skip writing entirely (returns empty paths).

Outputs: mesh_path, albedo_path, mr_path, normal_path - the paths to whatever got written, which you can feed to a display node or use to locate the file.

Install and dependencies

Pack install is the usual:

cd ComfyUI/custom_nodes
git clone https://github.com/ZXL-Xinram/ComfyUI-AutoFlow

restart. But this node pulls in two libraries the pack doesn't declare anywhere: trimesh and pygltflib, imported lazily when the node runs. If the ComfyUI-Hunyuan3DWrapper pack is installed, it already brought trimesh; pygltflib you may need to add yourself:

pip install pygltflib

And again - the TRIMESH type itself comes from the Hunyuan3D wrapper, not from this pack. Install that first or this node is useless.

Where people get burned

  • Shading artifacts in Blender → almost always the normal_texture mistake above. Disconnect it.
  • Missing pygltflib/trimesh import error on first run → the lazy imports mean you only find out at execution time. Install them.
  • Textures not showing in GLB viewers → make sure you're feeding IMAGE tensors with the channels the node expects; an RGB albedo is fine, but a 4-channel one from an alpha pipeline may confuse the material writer.

It's a niche node for a niche pipeline in a brand-new pack, but it's the only one here with a real opinionated take on a hard problem - and the warning comment about normal maps is worth its weight in Blender debugging time.

CategoryAutoFlow/Utilities

Inputs (7)

NameTypeDefaultDescription
trimeshTRIMESH
filename_prefixSTRING3D/textured_model
file_formatCOMBO2 options: glb, obj
albedo_textureoptIMAGE
mr_textureoptIMAGE
normal_textureoptIMAGE
save_fileoptBOOLEANtrue

Outputs (4)

NameTypeDescription
mesh_pathSTRING
albedo_pathSTRING
mr_pathSTRING
normal_pathSTRING