Ultimate Affine KSampler [Latent]
Ultimate Affine KSampler [Latent]
- latents
- model
- positive
- negative
- affine_schedule
- external_mask
- options
- noise_options
- LATENT
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
denoiseis 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
noiseinput 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.
Inputs (24)
| Name | Type | Default | Description |
|---|---|---|---|
| latents | LATENT | Input latents dict with key 'samples'. Supports [B,C,H,W] (images) or [B,C,F,H,W] (video). | |
| model | MODEL | Diffusion model to sample with. | |
| positive | CONDITIONING | Positive prompt conditioning. | |
| negative | CONDITIONING | Negative prompt conditioning. | |
| seed | INT | 00–18446744073709550000 | Seed for base sampler (noise). |
| steps | INT | 201–10000 | Number of denoising steps. |
| cfg | FLOAT | 8.00–100 | Classifier-free guidance scale. Can be a single float value or a per-step list. Short lists repeat last value. |
| sampler_name | COMBO | euler | Base sampler algorithm. |
| scheduler | COMBO | simple | Scheduler for sigma schedule. |
| denoise | FLOAT | 0.200–1 | Denoise fraction (<=1). |
| affine_interval | INT | 11–100 | Apply affine every N steps (1 = every step). |
| max_scale | FLOAT | 1.20000–2 | Scale at schedule peak: 1 + (max_scale-1)*t. |
| max_bias | FLOAT | 0.0000-2–2 | Bias at schedule peak: max_bias*t. |
| pattern | COMBO | white_noise | Affine mask pattern. |
| affine_seed | INT | 00–18446744073709550000 | Seed for affine mask generation. |
| affine_seed_increment | BOOLEAN | false | Increment affine seed after each application (temporal). |
| affine_schedule | DICT | WASAffineScheduleOptions dict. | |
| external_maskopt | IMAGE | Optional external mask to gate affine (adapted to latent space internally). | |
| optionsopt | DICT | Base options for Affine (common/full options). | |
| noise_optionsopt | DICT | Pattern-specific overrides layered onto 'options'. | |
| tile_widthopt | INT | 0-1–2048 | Latent-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_heightopt | INT | 0-1–2048 | Latent-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_overlapopt | INT | 80–256 | Latent-space overlap between sampling tiles. |
| batch_sizeopt | INT | 00–4096 | Process the batch dimension in chunks of this size to reduce peak VRAM. 0 = process all at once. |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| LATENT | LATENT | — |