Nodes/ComfyUI-MeshFlow/MeshFlow Remesh
ComfyUI Node

MeshFlow Remesh

When your 3D scan needs artist-grade cleanup

By Rizzlord·Created 3 months ago·Updated 2 months ago· 13
MeshFlow Remesh
  • trimesh
  • reference_image
  • trimesh
model_namemeshflow
steps28
samplerheun
guidance_scale2.5
seed42
base_num_verts4096
points4096
image_size512
devicecuda
dtypefp16
compilefalse
use_rmbgfalse
fill_holesfalse

You know the feeling: you've got a 3D model - a scan, a photogrammetry result, a messy download - and the topology is a disaster. Triangles of every size, uneven vertex density, open boundaries. Retopologizing by hand is hours of misery. MeshFlow Remesh hands that job to a diffusion model instead.

The name is doing a lot of work here, so let's be clear about what it is and isn't. This isn't text-to-3D generation. It's a ComfyUI wrapper around MeshFlow, Meta's research model for "artist-like mesh generation," and its job in your graph is remeshing: it takes an existing mesh in, and produces a clean, uniformly distributed vertex structure out. Optionally you can feed it a reference image to steer the result. It speaks TRIMESH, the same type used by 3D nodes like ComfyUI-PhantyForge, so it drops into a mesh pipeline and hands a clean mesh to whatever comes next.

How it actually works

Peek under the hood and the pipeline is honestly pretty elegant. Your input mesh gets preprocessed and normalized, then surface points are sampled from it and voxelized into 3D indices - that's the structural condition, fed into a diffusion transformer (DiT) via RoPE. If you've connected a reference_image, it gets encoded by a DINOv3 visual encoder and used as a conditioning signal; if not, the model runs on empty tokens. The actual generation happens in latent space with flow-matching sampling - the four sampler options (euler, midpoint, heun, rk4) are ODE solvers, and the default heun costs 2 model evals per step while rk4 costs 4, so it's slower but more accurate. Then the latent is decoded back into a mesh.

One detail worth knowing before you fight it: guidance_scale is only meaningful when a reference image is connected. No image, and the node silently forces guidance to 1.0 - CFG just doesn't exist without a visual condition to guide against.

The inputs that matter

There are a lot of knobs, but you'll actually touch maybe five:

  • model_name - meshflow is the standard checkpoint (fixed 4096 vertices). meshflow_w_num_verts_control unlocks the points input so you can pick your output resolution from 1024 to 16384.
  • points + base_num_verts - with the control model, points is your target vertex count and base_num_verts has to match the checkpoint you loaded.
  • reference_image (optional) - the visual guide. Pair it with image_size, guidance_scale, and use_rmbg (background removal before encoding, handy if your reference has a messy backdrop).
  • fill_holes - closes and triangulates boundary loops on the way out. Default off; turn it on if your output has open edges.
  • seed, steps, device, dtype, compile - the usual suspects. fp16 on cuda is the sane default; compile is a free speedup on CUDA if you have the patience for the first-run compile.

Output is a single trimesh (TRIMESH), which you wire into your next 3D node or export.

Installing it

Standard custom-node fare: install via ComfyUI Manager (search "ComfyUI-MeshFlow") or

cd ComfyUI/custom_nodes
git clone https://github.com/Rizzlord/ComfyUI-MeshFlow

then restart. The real work is the models, and the README's model layout is not optional - this node refuses to run without checkpoints exactly where it expects them:

ComfyUI/models/facebook/meshflow/meshflow/{config.yaml,model.pth}
ComfyUI/models/facebook/meshflow/meshflow_w_num_verts_control/{config.yaml,model.pth}

For offline image conditioning, drop the DINOv3 Vit-L/16 weights (dinov3_vitl16_pretrain_lvd1689m-8aa4cbdd.pth) into ComfyUI/models/facebook/dinov3-vitl16-pretrain-lvd1689m/. If you don't, the node git clones the DINOv3 repo into your torch hub cache on first run - which means it'll silently fail on a machine without network or git.

Where people get burned

The pack ships no requirements.txt, so it leans on whatever your ComfyUI environment already has - notably trimesh, omegaconf, and diffusers. If you get a ModuleNotFoundError on import, that's why; pip install trimesh omegaconf diffusers into your ComfyUI env and move on.

The most common hard failure is the missing-model error, and it's explicit about it: MeshFlow model path not found at .... That's your checkpoint not being in the right folder, not a broken install. Beyond that, set expectations: this is Meta's research model running in a wrapper written by one person, and there's essentially no community chatter about it yet. It's GPU-hungry diffusion - 16GB of VRAM is a comfortable floor - so don't expect a quick remesh on a 4060. But when you need genuinely clean, artist-like topology out of a dirty mesh, there's nothing else in ComfyUI doing quite this job.

CategoryMeshFlow

Inputs (15)

NameTypeDefaultDescription
trimeshTRIMESHThe input 3D model to be remeshed.
model_nameCOMBOmeshflowSelect the MeshFlow model to use. 'meshflow' is the standard model. 'meshflow_w_num_verts_control' allows dynamic control of the generated mesh resolution.
stepsINT281–1000Number of diffusion sampling steps. Higher values can increase detail but take longer.
samplerCOMBOheunODE solver for flow-matching sampling. Higher-order solvers (heun, rk4) produce more accurate trajectories; heun uses 2 model evals per step, rk4 uses 4.
guidance_scaleFLOAT2.50–100Classifier-Free Guidance (CFG) scale for visual conditioning. Only effective when reference_image is connected.
seedINT420–18446744073709550000Random seed for sampling latents.
base_num_vertsCOMBO4096The base resolution/point count of the loaded model checkpoint (sequence length).
pointsCOMBO4096Target resolution (points/vertices) of the generated output mesh.
image_sizeCOMBO512Resolution to resize and center crop the reference image to before processing.
deviceCOMBOcudaComputation device to run the model on (cuda or cpu).
dtypeCOMBOfp16Precision model dtype (fp16, bf16, or fp32).
compileBOOLEANfalseWhether to use torch.compile on CUDA for faster inference.
use_rmbgBOOLEANfalseEnable automatic background removal and foreground cropping for the reference image.
fill_holesBOOLEANfalseAutomatically closes and triangulates boundary loops in the final mesh topology.
reference_imageoptIMAGEOptional reference image for image-conditioned generation.

Outputs (1)

NameTypeDescription
trimeshTRIMESH