Adopt full MMH3 spatial split controls

This commit is contained in:
2026-09-03 16:15:43 +00:00
parent 0e119646ab
commit f6120a8500
4 changed files with 329 additions and 22 deletions
+55 -3
View File
@@ -469,12 +469,34 @@ class H3LatentUpscaleParams:
"tooltip": "Spatial tile height for the refinement stage in pixels. 512 matches the upstream latent-split default."}),
"overlap": ("INT", {"default": 64, "min": 0, "max": 4096, "step": 32,
"tooltip": "Pixel overlap between neighbouring spatial tiles. 64 matches the upstream latent-split default."}),
"fade_width": ("INT", {"default": 0, "min": 0, "max": 4096, "step": 32,
"tooltip": "Width in pixels of the freeze-to-free transition inside each overlap strip. 0 freezes the whole strip, matching the upstream default."}),
"fade_width": ("INT", {"default": 32, "min": 0, "max": 4096, "step": 32,
"tooltip": "Width in pixels of the freeze-to-free transition inside each overlap strip. 0 freezes the whole strip; 32 matches the upstream default."}),
"fade_height": ("INT", {"default": 32, "min": 0, "max": 4096, "step": 32,
"tooltip": "Height in pixels of the freeze-to-free transition inside each overlap strip. 0 freezes the whole strip; 32 matches the upstream default."}),
"overlap_mode": (["earlier", "later"], {"default": "earlier",
"tooltip": "Which tile wins the overlap band when stitching the spatial batches back together."}),
"overlap_blend": (["linear", "smoothstep", "overwrite", "midpoint"], {"default": "linear",
"tooltip": "How overlap bands are blended when the spatial batches are stitched back together."}),
"tile_size_mode": (["specific_size", "rows_cols"], {"default": "specific_size",
"tooltip": "How the spatial tile size is determined. 'specific_size' uses tile_width/tile_height. 'rows_cols' solves equal-size tiles from the target width/height and grid counts."}),
"grid_rows": ("INT", {"default": 2, "min": 1, "max": 9, "step": 1,
"tooltip": "Number of tile rows used when tile_size_mode = rows_cols."}),
"grid_cols": ("INT", {"default": 2, "min": 1, "max": 9, "step": 1,
"tooltip": "Number of tile columns used when tile_size_mode = rows_cols."}),
"spatial_w_overlap": ("INT", {"default": 128, "min": 0, "max": 4096, "step": 32,
"tooltip": "Desired horizontal overlap when tile_size_mode = rows_cols. The node solves the actual equal-tile overlap from the requested target size."}),
"spatial_h_overlap": ("INT", {"default": 128, "min": 0, "max": 4096, "step": 32,
"tooltip": "Desired vertical overlap when tile_size_mode = rows_cols. The node solves the actual equal-tile overlap from the requested target size."}),
"min_tile_size": ("INT", {"default": 256, "min": 0, "max": 4096, "step": 32,
"tooltip": "Minimum leftover edge tile size allowed when the spatial grid is solved."}),
"masked_area_noise": ("FLOAT", {"default": 0.0, "min": 0.0, "max": 1.0, "step": 0.01,
"tooltip": "How much noise is allowed into the masked overlap band during spatial refinement."}),
"brightness_match": ("BOOLEAN", {"default": False,
"tooltip": "Match each sampled tile's brightness baseline to the source tile region after sampling."}),
"dynamic_fade": (["off", "narrowing", "widening"], {"default": "off",
"tooltip": "Temporal fade schedule over each tile's sampling. Off keeps the fade fixed; narrowing shrinks it over steps; widening grows it over steps."}),
"dynamic_fade_min": ("INT", {"default": 32, "min": 0, "max": 4096, "step": 32,
"tooltip": "Minimum fade width used by dynamic_fade when it is enabled."}),
"chunk_length": ("INT", {"default": 136, "min": 17, "max": 100000, "step": 17,
"tooltip": "Reserved for upstream split compatibility. 136 matches the original chunk-length default."}),
"resize_conditioning": ("BOOLEAN", {"default": False,
@@ -484,7 +506,7 @@ class H3LatentUpscaleParams:
}
}
def build(self, mode, model_name, method, width, height, device, precision, sampler_name, scheduler, steps, denoise, megapixels, tile_width, tile_height, overlap, fade_width, overlap_mode, overlap_blend, chunk_length, resize_conditioning, anchor_strength):
def build(self, mode, model_name, method, width, height, device, precision, sampler_name, scheduler, steps, denoise, megapixels, tile_width, tile_height, overlap, fade_width, fade_height, overlap_mode, overlap_blend, tile_size_mode, grid_rows, grid_cols, spatial_w_overlap, spatial_h_overlap, min_tile_size, masked_area_noise, brightness_match, dynamic_fade, dynamic_fade_min, chunk_length, resize_conditioning, anchor_strength):
width = int(width)
height = int(height)
steps = int(steps)
@@ -492,6 +514,14 @@ class H3LatentUpscaleParams:
tile_height = int(tile_height)
overlap = int(overlap)
fade_width = int(fade_width)
fade_height = int(fade_height)
grid_rows = int(grid_rows)
grid_cols = int(grid_cols)
spatial_w_overlap = int(spatial_w_overlap)
spatial_h_overlap = int(spatial_h_overlap)
min_tile_size = int(min_tile_size)
masked_area_noise = float(masked_area_noise)
dynamic_fade_min = int(dynamic_fade_min)
chunk_length = int(chunk_length)
anchor_strength = float(anchor_strength)
if mode == "off":
@@ -509,8 +539,19 @@ class H3LatentUpscaleParams:
"tile_height": tile_height,
"overlap": overlap,
"fade_width": fade_width,
"fade_height": fade_height,
"overlap_mode": overlap_mode,
"overlap_blend": overlap_blend,
"tile_size_mode": tile_size_mode,
"grid_rows": grid_rows,
"grid_cols": grid_cols,
"spatial_w_overlap": spatial_w_overlap,
"spatial_h_overlap": spatial_h_overlap,
"min_tile_size": min_tile_size,
"masked_area_noise": masked_area_noise,
"brightness_match": bool(brightness_match),
"dynamic_fade": dynamic_fade,
"dynamic_fade_min": dynamic_fade_min,
"chunk_length": chunk_length,
"resize_conditioning": bool(resize_conditioning),
"anchor_strength": anchor_strength,
@@ -537,8 +578,19 @@ class H3LatentUpscaleParams:
"tile_height": tile_height,
"overlap": overlap,
"fade_width": fade_width,
"fade_height": fade_height,
"overlap_mode": overlap_mode,
"overlap_blend": overlap_blend,
"tile_size_mode": tile_size_mode,
"grid_rows": grid_rows,
"grid_cols": grid_cols,
"spatial_w_overlap": spatial_w_overlap,
"spatial_h_overlap": spatial_h_overlap,
"min_tile_size": min_tile_size,
"masked_area_noise": masked_area_noise,
"brightness_match": bool(brightness_match),
"dynamic_fade": dynamic_fade,
"dynamic_fade_min": dynamic_fade_min,
"chunk_length": chunk_length,
"resize_conditioning": bool(resize_conditioning),
"anchor_strength": anchor_strength,