Nodes/ComfyUI-TrellisMac/Export TrellisMac Mesh
ComfyUI Node

Export TrellisMac Mesh

The Node That Finally Turns Your Mesh Into a File

By dmvvilela·Created 2 months ago·Updated 2 months ago· 1
Export TrellisMac Mesh
  • mesh
  • glb_path
  • relative_path
filename_prefixTrellisMac/3D
file_format
texture_size
bake_texturetrue
also_objfalse

TrellisMacExport is where this pack pays off. The Generate node hands you a raw MeshWithVoxel - geometry plus a voxel attribute grid, nothing you can actually open yet. Export bakes that into PBR textures and writes a real 3D file into ComfyUI's output folder. The glb_path it returns plugs straight into ComfyUI's built-in Preview3D node, so you can spin the result around in the graph before you ever open Blender.

How it works - the bake. A generated mesh doesn't ship with a texture image; it carries a voxel field that has to be baked onto the surface. The node picks the best available method automatically:

  1. Metal GPU bake via o_voxel + mtldiffrast - fastest, hardware-accelerated.
  2. KDTree CPU fallback - xatlas UV unwrap plus a scipy nearest-voxel lookup. Same quality, noticeably slower.
  3. Vertex colors - bare geometry with no texture, only if there's no voxel data.

It pre-simplifies meshes to ≤200K faces before baking, which is what keeps the Metal path from blowing up.

The inputs that matter.

  • mesh - from the Generate node.
  • file_format - glb, obj, or ply. GLB is the one you want for Preview3D and most engines. obj skips the bake entirely and writes geometry directly - great for Blender or a 3D printer, but you get no textures with it.
  • texture_size - 1024 default; 2048 for more detail, 512 for small files.
  • bake_texture - on by default. Flip it off for a fast vertex-color-only export.
  • filename_prefix - default TrellisMac/3D, which is the subfolder/naming scheme inside your output dir.
  • also_obj - optional; writes a plain .obj alongside the GLB if you know you'll want it.

Outputs: glb_path (absolute path) and relative_path. Wire glb_path into Preview3D.

Installing. Same two-repo setup as the rest of the pack: a working trellis-mac checkout, install.py run with ComfyUI's Python, the gated HuggingFace licenses accepted, and PYTORCH_ENABLE_MPS_FALLBACK=1 at launch. Note that if you skipped the Metal packages (--skip-metal on the installer), everything still works - you just always take the KDTree path.

Where people get burned. The big one: a Metal bake failing and falling back to KDTree is expected on some meshes, not an error. mtlbvh can crash on very large meshes, and the fallback produces the same PBR result, just slower. Let it run. The console prints "Metal bake failed ... Falling back to KDTree" - that's the design, not a fault.

The other thing to keep expectations around: export doesn't fix what the generator produced. You're getting a textured triangle-soup mesh with machine-generated UVs - fine for a static prop, a render, or a print, but if it needs to animate, plan on a retopology and re-UV pass in Blender before it's game-ready. And if you only need an STL for a 3D printer, obj output is the fast path: no bake, geometry straight to disk, done.

CategoryTrellisMac

Inputs (6)

NameTypeDefaultDescription
meshMESHWITHVOXEL
filename_prefixSTRINGTrellisMac/3D
file_formatCOMBO3 options: glb, obj, ply
texture_sizeCOMBO3 options: 1024, 512, 2048
bake_textureBOOLEANtrue
also_objoptBOOLEANfalseAlso write a plain .obj alongside

Outputs (2)

NameTypeDescription
glb_pathSTRING
relative_pathSTRING