Nodes/ComfyUI-MIDI3D/Scene to Trimesh
ComfyUI Node

Scene to Trimesh

Merge the scene into one mesh so you can actually export it

By PozzettiAndrea-archive·Created 9 months ago·Updated 7 months ago· 3
Scene to Trimesh
  • scene
  • mesh

MIDI-3D Process hands you a MIDI3D_SCENE - a collection of individual meshes, one per object. Scene to Trimesh is the last stop in the pack: it merges all of those meshes into a single trimesh object you can hand to an export or preview node. It's the pack's exit door.

That's the whole job. One input (scene, from MIDI3DProcess - the type is compatible, so a textured scene from MIDI-3D Texture works too), one output: mesh, a TRIMESH. If the scene has a single object it just extracts it; if there are several, it concatenates them into one mesh and carries the scene's metadata along. In the pack's own workflows this feeds GeomPackPreviewMeshVTK from GeometryPack, which is how you actually see or save the result.

Why merge at all?

Because most mesh consumers - exporters, previewers, post-processing - want one mesh, not a scene graph of them. GeometryPack is the ecosystem this integrates with, and its preview/save nodes take a TRIMESH. If you want the individual objects kept separate, you can read them straight out of the scene elsewhere; this node exists specifically for the "give me one thing I can export" path.

The thing to know about merging

Concatenating meshes means shared vertices at the seams where objects touch - the chair's leg fused to the table's edge. That's fine for previewing, rendering, and most 3D-printing-adjacent uses, but it's not a "clean" union with welded topology. If your objects are close together, you may see interpenetrating geometry where the merge is ambiguous. The meshes themselves come from marching cubes on separate SDF grids, so they're already in world space and positioned correctly relative to each other; they just might slightly overlap.

For export, do this:

# or use any ComfyUI mesh-save node that accepts TRIMESH
mesh.export("scene.glb")

The node's output is a real trimesh.Trimesh, so anything downstream that understands trimesh (GeometryPack's exporters, or a small Python save node) can write it out as GLB/OBJ/PLY.

Where people stumble

  • "I get an error about 'scene' not being a Scene" - you fed it something else. It wants the MIDI3D_SCENE output, not MIDI3D_DATA (that's the preprocessed bundle) and not the raw model. Wrong-wire errors are the #1 issue here, and the fix is reading the connection, not the node.
  • Textures don't survive the merge - actually, they do: the node preserves the scene metadata and trimesh keeps per-geometry materials. But if you merge a textured scene and then re-export to a format that doesn't support the UV layout, textures can appear lost. Export to GLB for texture support; plain OBJ may need the textures alongside.
  • Giant merged file - every object's 4096×4096 UV (if textured) gets carried into the single mesh. Expect a big file and be patient with previewers.

It's the least glamorous node in the pack and also the most reliable one - no models, no VRAM, pure bookkeeping. Every MIDI-3D workflow ends here. When the grey or textured geometry is finally good, this is the node that lets you take it with you.

CategoryMIDI3D/Utils

Inputs (1)

NameTypeDefaultDescription
sceneMIDI3D_SCENEScene from MIDI3DProcess

Outputs (1)

NameTypeDescription
meshTRIMESHMerged trimesh from all scene objects