Export TrellisMac Mesh
The Node That Finally Turns Your Mesh Into a File
- mesh
- glb_path
- relative_path
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:
- Metal GPU bake via
o_voxel+mtldiffrast- fastest, hardware-accelerated. - KDTree CPU fallback - xatlas UV unwrap plus a scipy nearest-voxel lookup. Same quality, noticeably slower.
- 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, orply. GLB is the one you want for Preview3D and most engines.objskips the bake entirely and writes geometry directly - great for Blender or a 3D printer, but you get no textures with it.texture_size-1024default;2048for more detail,512for small files.bake_texture- on by default. Flip it off for a fast vertex-color-only export.filename_prefix- defaultTrellisMac/3D, which is the subfolder/naming scheme inside your output dir.also_obj- optional; writes a plain.objalongside 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.
Inputs (6)
| Name | Type | Default | Description |
|---|---|---|---|
| mesh | MESHWITHVOXEL | — | |
| filename_prefix | STRING | TrellisMac/3D | — |
| file_format | COMBO | 3 options: glb, obj, ply | |
| texture_size | COMBO | 3 options: 1024, 512, 2048 | |
| bake_texture | BOOLEAN | true | — |
| also_objopt | BOOLEAN | false | Also write a plain .obj alongside |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| glb_path | STRING | — |
| relative_path | STRING | — |