ComfyUI Node

Hy3D VAE Decode

Where latents stop being math and become an actual mesh you can touch

By kijai·Created 2 years ago·Updated 5 months ago· 1,033
Hy3D VAE Decode
  • vae
  • latents
  • trimesh
box_v1.010
octree_resolution384
num_chunks8000
mc_level0.0000
mc_algomc
enable_flash_vdmtrue
force_offloadtrue

Hy3DVAEDecode is the moment the Hunyuan3D shape model's work becomes something real. Upstream, Hy3DGenerateMesh produces shape latents - a compressed voxel-ish representation of the object. This node runs those latents through the VAE decoder and then extracts a triangle mesh from the result. No decode, no mesh. It's the difference between "I generated the idea of a chair" and "here's a chair I can export."

How it works

It takes a HY3DVAE (from Hy3DModelLoader or Hy3DVAELoader) and HY3DLATENT (from Hy3DGenerateMesh / Hy3DGenerateMeshMultiView), scales the latents back by the VAE's scale factor, decodes them, and runs marching cubes to carve a surface out of the decoded volume. The output is a TRIMESH - the type the whole rest of the pack consumes.

The inputs that actually matter, and that you'll tune:

  • octree_resolution (default 384) - how fine the voxel grid is. Higher means more geometric detail and more VRAM; 384 is the sensible default, and going higher is where cards start to sweat.
  • mc_algo - mc (plain marching cubes) or dmc (differentiable marching cubes). dmc generally gives cleaner geometry; mc is the safe fallback.
  • num_chunks (default 8000) - chunks processed per pass. Higher = faster, but the author's tooltip is the whole story: "higher values use more memory." When you OOM during decode, this is the first thing to turn down.
  • mc_level (default 0) - the iso-surface threshold. Leave it alone unless you know why you're touching it.
  • box_v (default 1.01) - the bounding volume the latents occupy.

Two optional toggles: enable_flash_vdm (default on, the fast decoder) and force_offload (default on, shoves the VAE back off GPU when done - leave it on unless your next node needs the VAE hot).

Where it sits

In the example workflow the chain is: LoadImageHy3DModelLoaderHy3DGenerateMeshHy3DVAEDecodeHy3DPostprocessMesh. So decode is the bridge between "shape sampling" and "mesh cleanup," and the mesh it spits out is raw - floaters, degenerate faces, way too many triangles. That's normal, not a bug; the postprocess node right after it exists to fix exactly that.

Install

Pack-level install (Manager search "Hunyuan3DWrapper", or git clone https://github.com/kijai/ComfyUI-Hunyuan3DWrapper into custom_nodes), then pip install -r requirements.txt. Decode needs no extra compiled deps - that's the texture stage's problem, not yours here.

Common issues

  • OOM at decode - drop octree_resolution toward 256 and num_chunks down; both are direct VRAM levers. Try mc instead of dmc too.
  • Watertight-looking but mushy - you're at a low octree resolution. If your card can take it, nudge toward 512.
  • VAE mismatch - decoding turbo latents with the standard VAE (or vice versa) gives garbage. The turbo VAE auto-detects in Hy3DVAELoader, but only if you actually loaded it.
CategoryHunyuan3DWrapper

Inputs (9)

NameTypeDefaultDescription
vaeHY3DVAE
latentsHY3DLATENT
box_vFLOAT1.010-10–10
octree_resolutionINT3848–4096
num_chunksINT80001–10000000Number of chunks to process at once, higher values use more memory, but make the process faster
mc_levelFLOAT0.0000-1–1
mc_algoCOMBOmc2 options: mc, dmc
enable_flash_vdmoptBOOLEANtrue
force_offloadoptBOOLEANtrueOffloads the model to the offload device once the process is done.

Outputs (1)

NameTypeDescription
trimeshTRIMESH