Nodes/ComfyUI-MakeSeamlessTexture/Seamless Texture Pre-Processor
ComfyUI Node

Seamless Texture Pre-Processor

Fix the lighting before you even try to make it seamless

By SparknightLLC·Created 7 months ago·Updated 7 months ago· 26
Seamless Texture Pre-Processor
  • image
  • image
pre_crop_left0
pre_crop_top0
pre_crop_bottom0
pre_crop_right0
lighting_correction_intensity65
lighting_correction_radius5

The most common reason a "seamless" texture still shows a seam has nothing to do with detail - it's brightness. A photo or render lit from one side has a slow gradient across it, and when you wrap it into a tile, the bright edge butts against the dark edge. No amount of edge blending fixes that; the two sides simply don't match in tone.

Seamless Texture Pre-Processor is the pre-flight step that tries to stop you from failing before you start. It does two things: crops junk off the edges, and flattens large-scale lighting gradients so the tileable result doesn't have a visible brightness band at the seam.

How it works

Two stages, both pure torch, both deterministic:

  1. Pre-crop. Cuts pre_crop_left/top/bottom/right pixels off each edge. Handy for removing a vignette, a sky gradient, stray UI text, or content you don't want wrapping around the tile.
  2. Lighting correction. This is the clever bit. It computes luminance, blurs it with a periodic (wrap-around) Gaussian - so the blur itself tiles - then scales each pixel so the blurred luminance is pulled toward the image's mean. The scale is clamped to 0.25–4.0 and blended in by the intensity. Net effect: broad lighting changes flatten, while fine detail keeps its local contrast.

The blur radius is normalized to image size - sigma ≈ (min(w,h)/256) × radius - so the default behaves consistently whether you feed it 512px or 2048px. And note the default lighting_correction_intensity is 65, not 0: this node is actively correcting out of the box.

The inputs that matter

  • lighting_correction_intensity (0–100, default 65) - how hard to flatten. 0 disables it entirely if you only want the crop.
  • lighting_correction_radius (1–20, default 5) - the scale of gradient it targets. Small radius corrects fine variations (and starts washing out local contrast); big radius only touches broad gradients. You'll rarely need to move it.
  • pre_crop_* - leave at 0 unless you actually have border junk.

The output is a single IMAGE (image), and it's designed to feed straight into Seamless Texture Radial Mask or Half Shift. The README's recommended chain, in fact, is: generate a texture (it suggests Flux Klein 4b or Z-Image Turbo with a circular VAE decode from spinagon's ComfyUI-seamless-tiling), push it through this pre-processor, then through the radial mask. The pre-processor exists to catch exactly the uneven lighting those generation paths leave behind.

Installation

Identical to the rest of the pack - no models, no extra dependencies beyond torch:

cd ComfyUI/custom_nodes
git clone https://github.com/SparknightLLC/ComfyUI-MakeSeamlessTexture

or search "ComfyUI-MakeSeamlessTexture" in ComfyUI Manager. Restart after installing.

Common issues

  • Correction too weak or too strong. Push intensity to 100 for a stubborn gradient, or drop to 0 if it's flattening the image into a gray mush. There's no middle setting that fits every source.
  • Radius wrong for your image. If you see the result look "veiny" or locally flat, the radius is too small - the correction is tracking local features instead of the gradient. Crank it up.
  • Cropping different-sized inputs. If you batch images that end up different sizes after the crop, the stacked output can fail. Feed it one image (or same-sized ones).
Categoryimage/texture

Inputs (7)

NameTypeDefaultDescription
imageIMAGEImage to pre-process before seamless generation.
pre_crop_leftINT00–8192Pixels to crop from the left edge before processing.
pre_crop_topINT00–8192Pixels to crop from the top edge before processing.
pre_crop_bottomINT00–8192Pixels to crop from the bottom edge before processing.
pre_crop_rightINT00–8192Pixels to crop from the right edge before processing.
lighting_correction_intensityINT650–100Strength of lighting correction (0 disables).
lighting_correction_radiusINT51–20Blur radius for lighting correction.

Outputs (1)

NameTypeDescription
imageIMAGE