Nodes/blender-in-comfyui/Blender Save Mesh
ComfyUI Node

Blender Save Mesh

Write that MESH from Load3D out as an actual GLB file

By JayLyu·Created about a year ago·Updated about a year ago· 5
Blender Save Mesh
  • mesh
  • glb_path
folder_typeoutput
filename_prefixmesh/ComfyUI

Most of this pack is about moving files through Blender. This node is the odd one out: it takes a MESH - actual vertex and face data living in the graph, the kind of thing that comes out of ComfyUI's core Load3D node or a 3D-generating workflow - and writes it straight to disk as a GLB file. No Blender involved at all. If you generated a 3D object in ComfyUI and you want to hand it to Blender, a game engine, or an asset viewer, this is your export button.

How it works

The mechanism is charmingly old-school: the node builds the GLB file by hand. It takes the vertices and faces tensors from your MESH, converts them to numpy, pads everything to 4-byte alignment, and assembles a valid glTF 2.0 binary - a JSON chunk describing buffer views, accessors, one mesh with a single triangle primitive, and a BIN chunk with the raw vertex and index data. It even writes metadata into the file's asset.extras, embedding your workflow prompt data. No Blender, no subprocess, no dependencies. That also means the output is a bare mesh: no materials, no UVs, no normals beyond what the accessors describe - fine for geometry transfer, not a finished PBR asset.

Inputs that matter

  • mesh - the MESH input. This is the one input type in the pack that's real geometry, not a file-path recipe. It expects tensors with a batch dimension, and the node saves mesh.vertices[0] and mesh.faces[0] - the first mesh in the batch - so keep that in mind if you're feeding it batched output.
  • folder_type - input or output. Defaults to output, so the GLB lands in ComfyUI/output/. Pick input and it writes into ComfyUI/input/ instead - useful if you immediately want to reference the file with a BL_Model_Param upstream.
  • filename_prefix - defaults to mesh/ComfyUI, which resolves to something like ComfyUI/output/mesh/ComfyUI_00001.glb. The node auto-increments the counter so you never overwrite a previous save.

The single output is glb_path (STRING) - the relative path to the saved file, ready to feed into a BL_Model_Param or just to note for later.

Wiring it

Core ComfyUI's Load3D outputs a MESH (plus a 3DVIEW for the graph's 3D preview). Wire that MESH into this node and you've turned a previewable object into a file on disk. From there the file can re-enter the scene side of the pack via BL_Model_Param - a handy round trip for "generate a mesh, save it, then stage and render it with the Blender nodes."

Installing it

Ships with the rest of blender-in-comfyui:

cd ComfyUI/custom_nodes
git clone https://github.com/JayLyu/blender-in-comfyui.git

Restart ComfyUI and look under the Blender category. Because this node doesn't shell out to Blender, it's the rare node in the pack that works even without --allow-subprocess - but your sibling nodes won't, so start ComfyUI with --allow-subprocess anyway and keep Blender 4.4+ in the pack's blender/ folder (auto-downloaded on Windows/Linux, manual on macOS).

Common issues

If you feed it a MESH that has zero vertices, the node logs "No mesh data to save" and returns an empty string - check that whatever produced the mesh actually ran. And because the writer only touches vertices[0]/faces[0], a batched mesh silently saves just the first sample; if you're generating multiple objects, save them one at a time or you'll wonder where the rest went. Beyond that it's a very simple node - the main failure mode is expecting it to output a textured, UV'd asset, which this honest little GLB writer won't give you.

CategoryBlender

Inputs (3)

NameTypeDefaultDescription
meshMESH
folder_typeCOMBOoutput2 options: input, output
filename_prefixSTRINGmesh/ComfyUI

Outputs (1)

NameTypeDescription
glb_pathSTRING