From 1ff4c037921487e1e432eb3f30aff615e9cbd759 Mon Sep 17 00:00:00 2001 From: Mike Ull <68799232+Rizzlord@users.noreply.github.com> Date: Sun, 7 Jun 2026 15:11:49 +0200 Subject: [PATCH] added input point number --- README.md | 3 ++- meshflow/pipelines/meshflow_pipeline.py | 20 +++++++++----------- nodes.py | 9 +++++---- 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/README.md b/README.md index 3bd00e5..a4e31f3 100644 --- a/README.md +++ b/README.md @@ -66,7 +66,8 @@ ComfyUI/models/facebook/dinov3-vitl16-pretrain-lvd1689m/ | `steps` | `INT` | Number of diffusion sampling steps (Default: 28). | | `guidance_scale` | `FLOAT` | CFG scale for image conditioning (Only active if `reference_image` is connected). | | `seed` | `INT` | Random seed for sampling latents. | -| `num_verts` | `COMBO` | Target vertex resolution (1024 to 8192). Only active with the `meshflow_w_num_verts_control` model. | +| `base_num_verts` | `COMBO` | The base resolution/point count of the loaded model checkpoint (1024, 2048, 4096, 8192, or 16384). | +| `points` | `INT` | Target vertex resolution of the generated output mesh (1024 to 16384). Only active with the `meshflow_w_num_verts_control` model. | | `device` | `COMBO` | Execution device: `cuda` or `cpu`. | | `dtype` | `COMBO` | Computation precision: `fp16`, `bf16`, or `fp32`. | | `compile` | `BOOLEAN` | Uses `torch.compile` on CUDA for faster inference speeds. | diff --git a/meshflow/pipelines/meshflow_pipeline.py b/meshflow/pipelines/meshflow_pipeline.py index 010b95e..c5cb4dc 100644 --- a/meshflow/pipelines/meshflow_pipeline.py +++ b/meshflow/pipelines/meshflow_pipeline.py @@ -119,18 +119,16 @@ class MeshFlowPipeline: use_proj_cond_on_temb = bool(scfg.denoiser_model.get("use_proj_cond_on_temb", False)) num_latents = int(scfg.mesh_model.num_latents) - if use_proj_cond_on_temb: - if num_verts is not None: - num_verts = int(num_verts) - config_num_verts = n_samples = input_size = num_verts + if num_verts is not None: + num_verts = int(num_verts) + config_num_verts = n_samples = input_size = num_verts + if use_proj_cond_on_temb: + pass + else: + num_latents = num_verts else: - if num_verts is not None: - print( - "[MeshFlowPipeline] Ignoring num_verts: " - "denoiser_model.use_proj_cond_on_temb is disabled in config" - ) - num_verts = None - num_latents = None + if not use_proj_cond_on_temb: + num_latents = None dtype = resolve_torch_dtype(dtype) device = torch.device(device if torch.cuda.is_available() or device == "cpu" else "cpu") diff --git a/nodes.py b/nodes.py index 192af0d..13e0e6e 100644 --- a/nodes.py +++ b/nodes.py @@ -50,7 +50,8 @@ class MeshFlowRemesh: "steps": ("INT", {"default": 28, "min": 1, "max": 1000, "step": 1, "tooltip": "Number of diffusion sampling steps. Higher values can increase detail but take longer."}), "guidance_scale": ("FLOAT", {"default": 2.5, "min": 0.0, "max": 100.0, "step": 0.1, "tooltip": "Classifier-Free Guidance (CFG) scale for visual conditioning. Only effective when reference_image is connected."}), "seed": ("INT", {"default": 42, "min": 0, "max": 0xffffffffffffffff, "tooltip": "Random seed for sampling latents."}), - "num_verts": ([1024, 2048, 3072, 4096, 5120, 6144, 7168, 8192], {"default": 4096, "tooltip": "Target vertex resolution. Roughly controls the generated mesh resolution."}), + "base_num_verts": ([1024, 2048, 4096, 8192, 16384], {"default": 4096, "tooltip": "The base resolution/point count of the loaded model checkpoint (sequence length)."}), + "points": ("INT", {"default": 4096, "min": 1024, "max": 16384, "step": 256, "tooltip": "Target resolution (points/vertices) of the generated output mesh."}), "device": (["cuda", "cpu"], {"default": "cuda", "tooltip": "Computation device to run the model on (cuda or cpu)."}), "dtype": (["fp16", "bf16", "fp32"], {"default": "fp16", "tooltip": "Precision model dtype (fp16, bf16, or fp32)."}), "compile": ("BOOLEAN", {"default": False, "tooltip": "Whether to use torch.compile on CUDA for faster inference."}), @@ -67,12 +68,12 @@ class MeshFlowRemesh: FUNCTION = "remesh" CATEGORY = "MeshFlow" - def remesh(self, trimesh, model_name, steps, guidance_scale, seed, num_verts, device, dtype, compile, use_rmbg, fill_holes, reference_image=None): + def remesh(self, trimesh, model_name, steps, guidance_scale, seed, base_num_verts, points, device, dtype, compile, use_rmbg, fill_holes, reference_image=None): model_path = os.path.join(folder_paths.models_dir, "facebook", "meshflow", model_name) if not os.path.isdir(model_path): raise FileNotFoundError(f"MeshFlow model path not found at {model_path}. Please download and place the config.yaml and model.pth in that directory.") - pipeline = get_pipeline(model_path, device, dtype, compile, num_verts) + pipeline = get_pipeline(model_path, device, dtype, compile, base_num_verts) pipeline.use_rmbg = use_rmbg if reference_image is not None: @@ -115,7 +116,7 @@ class MeshFlowRemesh: steps=steps, guidance_scale=guidance_scale, seed=seed, - num_verts=num_verts, + num_verts=points, return_latent=True )