Latent Affine Common Options
The mask-tuning DICT that makes Latent Affine behave
- options
In WAS Affine, the mask decides everything. The scale and bias just say how much; the mask says where, and a raw procedural pattern rarely lands exactly where you want it. That's what Latent Affine Common Options is for: it's a single node that builds the shared DICT of mask-tuning knobs and hands it to Latent Affine's options input. Every pattern type shares this post-processing stage, so you set it once and it applies across the board.
What's in it
- mask_strength (default 1) - scales the mask intensity before scale/bias are applied. 0.5 weakens the effect, 2.0 doubles it. This is your global "how hard does the affine bite" control.
- threshold - binarize the mask if above 0. 0.5 gives hard on/off separation; 0 leaves it smooth.
- invert_mask - flip dark/bright regions after threshold/blur. One-click way to say "everything except that region."
- blur_ksize / blur_sigma - Gaussian blur for soft mask edges. The fix for banding, which is the single most common Latent Affine complaint.
- clamp / clamp_min / clamp_max - clamp the output latent values (defaults -10 to 10) so extreme scaling can't blow the range.
- sharpen_enable / sharpen_sigma / sharpen_amount / sharpen_threshold - unsharp-mask the generated noise/mask before threshold/blur. Off by default; handy when you want the pattern's fine structure to actually register.
- frame_seed_stride (default 9973) - seed increment per frame in per_frame temporal mode.
- compute_device / device_index - where masks are generated.
autoprefers CUDA when available;cpufrees VRAM for huge video latents at a speed cost. - solid_alpha (default 1) - the constant alpha value the
solidpattern uses.
Output is a single options DICT, wired into Latent Affine's options input (or into any of the KSampler Affine / Custom Sampler Affine nodes' options). Pattern-specific knobs live separately and get layered on top via noise_options, so this stays clean: shared tuning here, pattern tuning there.
Installing
Part of WAS Affine by WASasquatch. ComfyUI Manager → Install Custom Nodes → search "WAS Affine" → install → restart, or:
cd ComfyUI/custom_nodes
git clone https://github.com/WASasquatch/was_affine
Restart ComfyUI. Requires ComfyUI 1.0.0+, deps are just torch and numpy.
Common issues
Forgetting the node is connected is the #1 bug - options is optional, so Latent Affine happily runs without it and your mask tuning silently does nothing. The classic beginner trap is a harsh pattern producing visible seams: feed it a little blur_sigma (1.5 is a reasonable start) before complaining about the effect. And if you're doing per-frame video work on a big latent and hitting VRAM limits, flip compute_device to cpu - mask generation doesn't need to compete with the model for memory.
Inputs (16)
| Name | Type | Default | Description |
|---|---|---|---|
| mask_strength | FLOAT | 1.0000–2 | Scales mask intensity before applying scale/bias. |
| threshold | FLOAT | 0.0000–1 | Binarize mask if > 0. |
| invert_mask | BOOLEAN | false | Invert after threshold/blur. |
| sharpen_enable | BOOLEAN | false | Sharpen the generated noise/mask before threshold/blur using unsharp masking. Off by default. |
| sharpen_sigma | FLOAT | 0.800–8 | Sharpen radius (Gaussian sigma). 0 disables. Typical: 0.5-1.5. |
| sharpen_amount | FLOAT | 0.30-5–5 | Sharpen gain. 0 = none; 0.3 subtle; 1.0 strong. Negative softens (inverse). Extended range [-5,5] for stronger effects. |
| sharpen_threshold | FLOAT | 0.000–1 | Only enhance details where |orig-blur| exceeds this threshold. Helps avoid amplifying flat noise. |
| blur_ksize | INT | 00–51 | Gaussian blur kernel size (odd). |
| blur_sigma | FLOAT | 0.00–16 | Gaussian blur sigma. |
| clamp | BOOLEAN | false | Clamp output latent values to [min,max]. |
| clamp_min | FLOAT | -10.0-100–0 | Lower clamp bound when clamping is enabled. |
| clamp_max | FLOAT | 10.00–100 | Upper clamp bound when clamping is enabled. |
| frame_seed_stride | INT | 99731–100000 | Seed increment per frame when temporal mode is per_frame. |
| compute_device | COMBO | cpu | Where to generate procedural masks/noise. 'auto' prefers CUDA when available; otherwise CPU. |
| device_index | INT | 00–7 | CUDA device index when using GPU. |
| solid_alpha | FLOAT | 1.0000–1 | Solid mask constant alpha (0..1). 0 disables; 1 full mask. |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| options | DICT | — |