Nodes/ComfyUI-NO8D-controls/NO8D Ref Tile Align
ComfyUI Node

NO8D Ref Tile Align

The model shifted your tile three pixels, and this moves it back

By no8d·Created 6 months ago·Updated 3 days ago· 325
NO8D Ref Tile Align
  • generated
  • reference
  • image

Ask a diffusion model to redraw a 1700-pixel tile and it will not put the buildings back exactly where they were. It'll rotate by a fraction of a degree, slide the horizon up a couple of pixels, and locally disagree with itself about where edges belong. One tile looks great on its own. Nine of them side by side look like a bad panorama stitch. NO8D Ref Tile Align is the node that quietly fixes that, and it's the reason this workflow holds together at 3K.

Where it sits

This is the first of the two cleanup nodes that run after VAEDecode and before the stitch. Its job isn't aesthetics, it's geometry: register each freshly generated tile back onto the source tile it came from, so the seams have something to blend instead of two misaligned copies of the same wall.

Note that this is a per-tile repair, not a whole-image one. In the author's example workflow both of its inputs come off NO8D Ref Tile Split's tile list in list context, so it runs once per tile. That matters - if you stick a global registration node after the stitch instead, it has to pick one transform for the entire picture, and the whole point is that each tile drifted differently.

How it works, roughly

It's classical computer vision, not another model - OpenCV, on the CPU, per tile:

  1. If the generated tile isn't the same size as the reference, it's resized to match with bicubic.
  2. Both are scaled down to a working size (640 on the long edge max), converted to greyscale and blurred. Registering on small greyscale images is much more robust than on full-res RGB.
  3. cv2.findTransformECC in MOTION_AFFINE mode, up to 100 iterations, gives a candidate affine transform.
  4. That transform is throwaway-able. It's rejected if the correlation score is below 0.94, if the linear part deviates from identity by more than 0.025, or if any corner would move more than 3.5% of the short edge. Then the aligned version is only kept if its correlation actually improves on the unaligned one.
  5. Local pass: a 7×7 grid of patches, each getting its own small ECC translation search. A patch's offset is only accepted if it scores ≥0.94, stays under 1% of the short edge, and measurably improves that patch's correlation. Flat patches (low standard deviation) are skipped outright.
  6. Those patch offsets are smoothed and interpolated into a dense flow field, then the full-resolution generated tile is remapped through the combined affine-plus-local displacement using Lanczos.

The guards are the interesting design decision. This node is built to do nothing when it isn't confident - if nothing improves, you get your tile back untouched. That's the right call for a step that runs unattended on twenty tiles, and it's also why you shouldn't expect a dramatic difference when you use it. You notice it when it's missing, not when it's there.

Inputs and output

Two required inputs and no widgets at all: generated (the decoded tile from VAEDecode) and reference (the source tile from Split - same list, same order). One output, image, which goes into NO8D Ref Tile Color Match.

Both inputs take exactly one frame. Give it a batch and it stops with "Tile Align expects one frame." That's deliberate: it's a list-context node and ComfyUI will call it once per tile for you.

Installing

Part of the same pack, so there's nothing extra to fetch:

cd ComfyUI/custom_nodes
git clone https://github.com/no8d/ComfyUI-NO8D-controls.git

or let ComfyUI Manager install "ComfyUI-NO8D-controls" and its requirements.txt for you. Restart and hard-refresh the page. The node is in the NO8D/H3 category and has no widgets, which confuses people looking for a strength slider - there isn't one, on purpose. Every threshold in the list above is a constant in the pack's _tiled_reference_helpers.py, not a knob.

The GitHub README doesn't mention these H3 nodes at all; the pack's own notes are in docs/tiled-reference-upscale.md, in Chinese. That file is specific about why this node is kept as source rather than handed to a native node: the ECC affine plus local displacement correction had no equivalent in the official set.

When it doesn't help

Low-texture tiles. Sky, gradients, blank walls, shallow depth of field - these get skipped by design. Blurry tiles come out unaligned, which is usually invisible and occasionally isn't.

Tiles the model rewrote rather than restored. Alignment is registration, not correction. If the sampler decided the window frame should be somewhere else entirely, the affine guard rejects the fit (correctly) and the tile stays put. The fix there is upstream: lower denoise, a stronger prompt, or accept that aggressive redraw and the stitch are fundamentally at odds. That tradeoff is the whole second half of our upscaling notes - the more the model invents, the less anything geometric can put it back.

Speed. 100 ECC iterations plus 49 patch searches per tile, on the CPU. Not free on a twenty-tile 3K run - though still cheap next to six sampling passes per tile.

CategoryNO8D/H3

Inputs (2)

NameTypeDefaultDescription
generatedIMAGE—
referenceIMAGE—

Outputs (1)

NameTypeDescription
imageIMAGE—