MeshFlow Remesh
When your 3D scan needs artist-grade cleanup
- trimesh
- reference_image
- trimesh
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-meshflowis the standard checkpoint (fixed 4096 vertices).meshflow_w_num_verts_controlunlocks thepointsinput so you can pick your output resolution from 1024 to 16384.points+base_num_verts- with the control model,pointsis your target vertex count andbase_num_vertshas to match the checkpoint you loaded.reference_image(optional) - the visual guide. Pair it withimage_size,guidance_scale, anduse_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;compileis 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.
Inputs (15)
| Name | Type | Default | Description |
|---|---|---|---|
| trimesh | TRIMESH | The input 3D model to be remeshed. | |
| model_name | COMBO | meshflow | Select the MeshFlow model to use. 'meshflow' is the standard model. 'meshflow_w_num_verts_control' allows dynamic control of the generated mesh resolution. |
| steps | INT | 281–1000 | Number of diffusion sampling steps. Higher values can increase detail but take longer. |
| sampler | COMBO | heun | ODE 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_scale | FLOAT | 2.50–100 | Classifier-Free Guidance (CFG) scale for visual conditioning. Only effective when reference_image is connected. |
| seed | INT | 420–18446744073709550000 | Random seed for sampling latents. |
| base_num_verts | COMBO | 4096 | The base resolution/point count of the loaded model checkpoint (sequence length). |
| points | COMBO | 4096 | Target resolution (points/vertices) of the generated output mesh. |
| image_size | COMBO | 512 | Resolution to resize and center crop the reference image to before processing. |
| device | COMBO | cuda | Computation device to run the model on (cuda or cpu). |
| dtype | COMBO | fp16 | Precision model dtype (fp16, bf16, or fp32). |
| compile | BOOLEAN | false | Whether to use torch.compile on CUDA for faster inference. |
| use_rmbg | BOOLEAN | false | Enable automatic background removal and foreground cropping for the reference image. |
| fill_holes | BOOLEAN | false | Automatically closes and triangulates boundary loops in the final mesh topology. |
| reference_imageopt | IMAGE | Optional reference image for image-conditioned generation. |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| trimesh | TRIMESH | — |