Nodes/kubakub nodes/kubakub director diffuse
ComfyUI Node

kubakub director diffuse

The node the director builds for you (don't hand-wire it)

By kubakubkub·Created about a month ago·Updated 2 days ago· 10
kubakub director diffuse
  • model
  • clip
  • vae
  • image
◄image►
◄mask►
◄prompt►
◄moderediffuse►
◄denoise0.60►
◄steps4►
◄seed0►
◄megapixels1.00►
◄band_px16►
◄referencetrue►
◄request►

What it's for

You're in the director window, the composition is working, and one layer needs to be different - a shopfront should read as a shop, that balcony needs a plant on it, this region's paint job is wrong. You don't want to leave the window, rebuild the graph, render, and come back.

kubakub director diffuse repaints one area and writes the result into input/kuba_director, where the director's window picks it up as a new layer. It's a masked crop-diffusion: a crop, a grey mask, a prompt, a denoise, and back comes a picture.

The important, slightly unusual thing: this node is not meant to be wired by hand. The director window builds and queues this graph itself when you ask it to re-diffuse a layer. If you're staring at it in the node browser wondering how to hook it up, you're doing the thing the author tells you not to do.

How it works

Crop the region, diffuse inside the mask, keep the rest. The mechanism has three parts worth understanding, because they're the difference between a good result and mush:

  • mode - rediffuse changes the shape and an edge band around it (so the seam blends), edges changes only the band. If your edit leaves a visible ring, that's the band doing its job badly, not a bug in the mask.
  • denoise - 0 is nothing, 1 paints the mask from scratch. Halfway is where most "make this window a shop" work sits; the pack's own workflows use ~0.95 when the target is a generated frame (i.e. letting the model invent the room) and much less when it's a correction.
  • reference - on by default: the crop goes in as a reference latent, which is what keeps the layout and the colours in the family of what's already there. Turn it off and the model is free to reinterpret the whole crop, which is occasionally what you want and usually not.

It runs Flux 2 Klein by default with your LoRAs on the model, at 4 steps, because that's a distilled model - the KB's distillation material is the background here: 4 steps at CFG 1 is not a compromise for a distilled checkpoint, it's how it's meant to run. Running a distilled model at 20 steps wastes time; running a base model at 4 gives you garbage.

Inputs and outputs

Required: model, clip, vae (Klein by default, clip and vae must match), image (the crop to diffuse, as a string path in ComfyUI's input folder - not an image wire), mask (a string path to a grey mask of the same crop: white = the shape to change), prompt, mode, denoise, steps, seed, megapixels, band_px, reference and request.

Two of those are worth spelling out. The image and mask are string paths, not image inputs, because the window hands the node files on disk. And request is the id the window matches the answer with - leave it alone and the window won't find the result. The crop is diffused at megapixels (default 1, 0.1 to 4) and the result keeps that size; band_px (16) is the edge band in crop pixels.

One output: image, the diffused crop, which is also written for the window. That's the whole node - no masks, no reports, because it isn't a pipeline component, it's a work order.

Install

Manager → kubakub nodes → install → restart. Or:

cd ComfyUI/custom_nodes
git clone https://github.com/kubakubkub/ComfyUI_KubaNodes
python -m pip install -r ComfyUI_KubaNodes/requirements.txt

ComfyUI 0.37.0 or newer. The pack's only added package is opencv-python-headless (keep your own OpenCV build). This one needs a diffusion model and matching CLIP/VAE - Flux 2 Klein 4B is the smallest sensible choice, and the pack's model list has variants for it (bf16, fp8, GGUF - any of them, pick your file in the loader). No Blender required.

Common issues

  • "file not found" on the crop or the mask. They're paths relative to ComfyUI's input folder, and the window writes them there. If you're hand-testing, that's where your test files have to live.
  • The window never sees the result. Wrong or missing request. The window builds it; don't touch it.
  • A visible ring around the edit. Widen band_px so the blend has more room, and lower denoise a touch - the band is where the model has to agree with what's already there, and it can only do that if it's been given a gradient to work with.
  • The new layer looks pasted on. That's a job for colour match, not more denoise. Match the layer to the composition before you decide the diffusion was bad.
Categorykubakub/2d/director

Inputs (14)

NameTypeDefaultDescription
modelMODELThe diffusion model (Flux 2 Klein by default, with your LoRAs).
clipCLIPThe text encoder that matches the model.
vaeVAEThe VAE that matches the model.
imageSTRINGCrop to diffuse, in ComfyUI's input folder.
maskSTRINGGrey mask of the same crop: white = the shape to change.
promptSTRINGWhat the area should become (empty = no text guidance).
modeCOMBOrediffuserediffuse = the shape and its edge band, edges = only the band around it.
denoiseFLOAT0.600–1How much changes: 0 = nothing, 1 = painted from scratch inside the mask.
stepsINT41–100Sampling steps (4 suits Flux 2 Klein, 8-16 Flux 3 Klein).
seedINT00–18446744073709550000Random seed; another seed gives another variant.
megapixelsFLOAT1.000.1–4Size the crop is diffused at, in megapixels (the result keeps that size).
band_pxINT160–512Edge band around the shape (crop pixels).
referenceBOOLEANtrueThe crop as reference latent (keeps layout and colours).
requestSTRINGId the window matches the answer with.

Outputs (1)

NameTypeDescription
imageIMAGEThe diffused crop (also written for the window as a new layer).