ComfyUI Node

Trimesh to MESH

Strip a trimesh down to bare geometry — vertices and faces as torch tensors

By kijai·Created 2 years ago·Updated 5 months ago· 1,033
Trimesh to MESH
  • trimesh
  • MESH

TrimeshToMESH is the converter that reduces a full TRIMESH to the pack's minimal MESH object - just vertices and faces, as batched torch tensors, nothing else. The author's own description says it plainly: it produces "MESH object containing vertices and faces as torch tensors," a type that "only includes mesh data." No textures, no UVs, no normals, no materials. Geometry, full stop.

It's the other half of the converter pair that MESHToTrimesh completes, and the pair exists because the wrapper internally juggles two mesh representations. The fat TRIMESH is what every useful node in the pack wants; the lean MESH is the stripped-down interchange format for when all you need is the soup of triangles. If some node hands you a MESH socket and you need a TRIMESH, that's the sibling node. If you have a TRIMESH and something downstream only wants raw geometry - this is your node.

How it works

One input (trimesh), one output (MESH). It reads the vertices and faces, converts them to float32 torch tensors, adds a leading batch dimension, and wraps them in the pack's MESH class:

vertices = torch.tensor(trimesh.vertices, dtype=torch.float32)
faces = torch.tensor(trimesh.faces, dtype=torch.float32)
mesh = MESH(vertices.unsqueeze(0), faces.unsqueeze(0))

That's the whole thing - a shape conversion with no model, no GPU, no time. The MESH type is exactly this: a tiny object with a batched vertices tensor and a batched faces tensor.

One quirk to file away so it doesn't throw you: both converter nodes in this pair ship the same copy-pasted description ("Converts trimesh object to ComfyUI MESH object"). This one actually does that; its sibling does the reverse. Trust the socket types, not the blurb.

When you'd use it

Rarely in a stock workflow - the pack's own pipeline produces and consumes TRIMESH end to end. You'd reach for it when you're integrating with another pack or writing custom nodes that want the lightweight MESH representation, or when you genuinely only need the geometry and want to drop everything else to save memory. If a socket mismatch is blocking you, this is the adapter to clear it.

Install

Pack-level: Manager search "Hunyuan3DWrapper", or git clone https://github.com/kijai/ComfyUI-Hunyuan3DWrapper, then pip install -r requirements.txt. Nothing extra - this node is trimesh reading and tensor casting.

Common issues

  • Lost my textures/UVs - expected. MESH carries only geometry by design; this is a one-way simplification. Keep your TRIMESH if you still need the materials.
  • Socket won't connect downstream - the MESH you produced is this pack's type; if the target node is from a different pack, its MESH may be a different type entirely. ComfyUI types are per-pack, so check the target's expectations before blaming this node.
CategoryHunyuan3DWrapper

Inputs (1)

NameTypeDefaultDescription
trimeshTRIMESH

Outputs (1)

NameTypeDescription
MESHMESHMESH object containing vertices and faces as torch tensors.