Nodes/MTB Nodes/Model Patch Seamless (mtb)
ComfyUI Node Runs on cloud

Model Patch Seamless (mtb)

Generate tileable, seamless images at inference

By melMass·Created 3 years ago·Updated about a month ago· 721
Model Patch Seamless (mtb)
  • model
  • Original Model (passthrough)
  • Patched Model
startStep0
stopStep999
tilingXtrue
tilingYtrue

If you want a texture that tiles - brick, grass, fabric, stone - that repeats forever with no visible seam, this is the node that makes the model produce it directly. Model Patch Seamless (mtb) patches the model so the image it generates is seamless right at the inference stage, instead of you fighting to make a normal render tile afterward.

This is a texturing tool at heart. The classic use case is PBR material creation: generate a seamless albedo here, run it through an upscale, then hand it to a normal-map generator like DeepBump (also in this pack) to get a tileable material you can drop into Blender, Unreal, or a game engine. The author's own examples pair it with exactly that pipeline. It also just makes nice repeating backgrounds and patterns.

It's in the textures corner of MTB Nodes (comfy_mtb) by melMass, and the author is upfront that it's a clever hack - results vary with the model and prompt.

How it works

Normally a diffusion model's convolutions use zero-padding at the image edges, which is why generations don't naturally tile - the borders don't know about each other. This node patches the model's padding to be circular (the left edge wraps to the right, top to bottom) during sampling, so the model treats the canvas as a torus and the output tiles seamlessly. You can also confine the effect to a range of sampling steps, which is the trick for getting seamless edges without forcing the entire composition to wrap.

The inputs and outputs that matter

  • model (MODEL) - the model to patch. Wire your loaded checkpoint in here.
  • tilingX / tilingY (both default on) - which axes tile. Leave both on for a fully repeating texture; turn one off for something that tiles only horizontally (a repeating strip) or only vertically.
  • startStep (default 0) / stopStep (default 999) - the sampling-step window where tiling is active. Defaults cover the whole sampling run. Narrowing the window (for example, only the early steps) lets the overall layout tile while later steps add detail more freely - useful when full-range tiling flattens the result.

It has two outputs: Patched Model - the one you feed to your KSampler to get seamless output - and Original Model (passthrough), the unpatched model handed straight back so you can branch a non-tiling path from the same graph without reloading.

How to install it

ComfyUI Manager: search MTB Nodes, install, restart. Manual:

cd ComfyUI/custom_nodes
git clone https://github.com/melMass/comfy_mtb

then restart. The seamless patch itself is pure Python and needs nothing extra. Note that the full texture pipeline the author demonstrates uses DeepBump for the normal-map step - that's a separate node, and it needs its deepbump256.onnx model downloaded into models/deepbump/ (ComfyUI Manager can fetch it). This seamless node on its own has no such requirement.

Common issues & troubleshooting

"Results might vary." The author says it outright, and it's true - how cleanly a model tiles depends on the checkpoint and the prompt. Textural, repeating subjects (stone, foliage, fabric) tile beautifully; a prompt with a single centered subject fights the wrapping. Prompt for a pattern, not a hero object.

The whole composition wraps weirdly. If forcing tiling across all steps warps your layout, pull stopStep in so tiling only applies during the earlier steps, then let the later steps refine detail. That often keeps the seam clean without distorting the content.

Downstream nodes see the wrong model. Two outputs, two meanings: feed Patched Model to the sampler you want seamless, and use Original Model (passthrough) for anything that should stay normal. Wiring the passthrough into your sampler by mistake is why "the tiling did nothing."

DeepBump throws an ONNX error in the wider material pipeline. That's a separate node with its own model file and a known sensitivity to ONNX runtime versions - grab the model via ComfyUI Manager and check your AV didn't eat the .onnx. It's unrelated to the seamless patch itself.

Categorymtb/textures

Inputs (5)

NameTypeDefaultDescription
modelMODEL
startStepINT0
stopStepINT999
tilingXBOOLEANtrue
tilingYBOOLEANtrue

Outputs (2)

NameTypeDescription
Original Model (passthrough)MODEL
Patched ModelMODEL