Nodes/WAS Affine/Ultimate Affine KSampler [Latent]
ComfyUI Node

Ultimate Affine KSampler [Latent]

Ultimate Affine KSampler [Latent]

By WASasquatch·Created about a year ago·Updated 5 months ago· 5
Ultimate Affine KSampler [Latent]
  • latents
  • model
  • positive
  • negative
  • affine_schedule
  • external_mask
  • options
  • noise_options
  • LATENT
seed0
steps20
cfg8.0
sampler_nameeuler
schedulersimple
denoise0.20
affine_interval1
max_scale1.2000
max_bias0.0000
patternwhite_noise
affine_seed0
affine_seed_incrementfalse
tile_width0
tile_height0
tile_overlap8
batch_size0

WASUltimateCustomAdvancedAffineNoUpscaleLatent - "Ultimate Affine KSampler [Latent]" - is the sibling of the image-based Ultimate Affine KSampler with one crucial difference: it takes a latent in and hands a latent back. No VAE encode, no decode, no pixel round-trip. You get the same tiled, affine-scheduled sampling pass, but you stay in compressed space the whole time, which is exactly the "works in latent space – avoids costly VAE decode/encode cycles" selling point the README leads with.

Why would you want that? Three reasons. You're mid-pipeline and the next step wants a latent anyway (another sampler, a save, a second pass). You're working with video through the pack's Wan nodes - WASWANVAEEncode in, this node in the middle, WASWANVAEDecode out. Or you just don't trust the VAE round-trip to preserve whatever the affine pass is doing - and honestly, keeping the tensor you've been sampling in the space it was sampled in is a defensible instinct. Each VAE jump is where subtle color and structure drift sneaks in.

How it works

The core is the same engine as the image variant: a sampler with affine transforms applied every affine_interval steps. max_scale (default 1.2) ramps as 1 + (max_scale-1)*t toward the schedule peak, max_bias (default 0) adds a progress-scaled brightness offset, and the pattern (26 choices, default white_noise) decides which masked regions get touched. affine_seed drives the mask; affine_seed_increment varies it per application for temporal motion. Optional external_mask (adapted to latent space internally), plus the options/noise_options dicts for fine control. Standard sampler plumbing is all here: sampler_name (default euler), scheduler (default simple), steps, cfg - and cfg can be a per-step list, which is a genuinely handy way to shape guidance over the pass.

The tiling here is latent-space tiling, and the units tell you the story: tile_width/tile_height default 0 (no tiling), -1 auto-sizes to ≤128 latent pixels (the tooltip notes that's ~1024px of image space at 8x compression), and tile_overlap defaults to 8 latent pixels. Because latent tiles are small and cheap, you can tile aggressively without the cost you'd expect - that's the beauty of sampling compressed.

The input accepts both shapes. latents supports [B,C,H,W] for images and [B,C,F,H,W] for video - the Wan encode node's output drops straight in. batch_size (default 0 = all at once) chunks the batch dimension for VRAM relief on big video latents.

The output

A LATENT dict, ready to feed another sampler, a save-latent node, or the pack's WASWANVAEDecode when you finally want pixels.

Installing it

Part of WAS Affine (WASasquatch/was_affine). Manager: search "WAS Affine", install, restart. Or:

cd ComfyUI/custom_nodes
git clone https://github.com/WASasquatch/was_affine.git

No models to download; deps are torch/numpy (plus matplotlib). Doesn't require UltimateSDUpscale nodes despite the name.

Where people get burned

  • denoise is the dial you'll actually touch. Default 0.2 - a re-detail pass, not a regeneration. Push it toward 0.5 and you're rewriting the image; the low end is where this node shines.
  • Model sensitivity again. The README's warning applies here too: Flux/Krea-family models can respond to scale in the opposite direction, and Lightning LoRAs want low CFG (1–2). If the output looks off, suspect the affine direction before the tiling.
  • Latent tiling overlap in latent pixels. 8 is the default for a reason - cranking it toward the 256 max multiplies blended regions for near-zero benefit.
  • The noise input is deprecated - it exists for backward compatibility and does nothing. If an old workflow wires noise into this node, it's safe to ignore, but clean it out rather than trusting it.

If you want the tiled-affine detail pass without leaving compressed space - for video especially - this is the node. Keep the VAE steps where they belong: at the edges.

Categorylatent/sampling

Inputs (24)

NameTypeDefaultDescription
latentsLATENTInput latents dict with key 'samples'. Supports [B,C,H,W] (images) or [B,C,F,H,W] (video).
modelMODELDiffusion model to sample with.
positiveCONDITIONINGPositive prompt conditioning.
negativeCONDITIONINGNegative prompt conditioning.
seedINT00–18446744073709550000Seed for base sampler (noise).
stepsINT201–10000Number of denoising steps.
cfgFLOAT8.00–100Classifier-free guidance scale. Can be a single float value or a per-step list. Short lists repeat last value.
sampler_nameCOMBOeulerBase sampler algorithm.
schedulerCOMBOsimpleScheduler for sigma schedule.
denoiseFLOAT0.200–1Denoise fraction (<=1).
affine_intervalINT11–100Apply affine every N steps (1 = every step).
max_scaleFLOAT1.20000–2Scale at schedule peak: 1 + (max_scale-1)*t.
max_biasFLOAT0.0000-2–2Bias at schedule peak: max_bias*t.
patternCOMBOwhite_noiseAffine mask pattern.
affine_seedINT00–18446744073709550000Seed for affine mask generation.
affine_seed_incrementBOOLEANfalseIncrement affine seed after each application (temporal).
affine_scheduleDICTWASAffineScheduleOptions dict.
external_maskoptIMAGEOptional external mask to gate affine (adapted to latent space internally).
optionsoptDICTBase options for Affine (common/full options).
noise_optionsoptDICTPattern-specific overrides layered onto 'options'.
tile_widthoptINT0-1–2048Latent-space sampling tile width. 0 disables tiling (single pass). -1 auto-calculates proportional tile size ≤128 latent pixels (1024px image space with 8x compression).
tile_heightoptINT0-1–2048Latent-space sampling tile height. 0 disables tiling (single pass). -1 auto-calculates proportional tile size ≤128 latent pixels (1024px image space with 8x compression).
tile_overlapoptINT80–256Latent-space overlap between sampling tiles.
batch_sizeoptINT00–4096Process the batch dimension in chunks of this size to reduce peak VRAM. 0 = process all at once.

Outputs (1)

NameTypeDescription
LATENTLATENT