SamplerDistanceAdvanced
Every dial the DistanceSampler pack hides from you
- SAMPLER
If SamplerDistance is the set-and-forget version of this pack, SamplerDistanceAdvanced is the version that dumps all 18 parameters on you and says good luck. Same core algorithm underneath - each step makes several candidate predictions and fuses them by proximity weighting, so agreeing predictions carry more weight - but now you get every flag the pack author ever tinkered with, including a few he'd rather you not touch. Most people land here because they want exactly one of three things: the negative-assisted variant, the smoother slerp combination, or the ability to only run the expensive distance logic for part of the schedule. All three are exposed.
The inputs people actually use
The full list is long, so let's separate the useful from the decorative.
The ones that change the output character:
use_negative(default false) - the "n" variant. When on, the unconditional (negative) prediction is fed into the distance-score calculation, so candidates are also weighted by how far they are from the negative. The author's own note: "This tends to give images with less errors from my testing," and it's what he samples with by default. Results do shift depending on your negative prompt, so expect to tune it.use_slerp(default false) - combines candidate predictions by spherical interpolation instead of a weighted average. The difference is more obvious whenuse_negativeis on. This is the setting the pack's own named presets (Distance,Distance_n,Distance_p) all use.distance_first/distance_last(defaults 0 and -1, i.e. every step) - restrict the expensive distance sampling to a slice of the schedule. Steps are zero-based and negatives count from the end. This is the community's favorite trick with this sampler: people running it to fix anatomy in video keep it on for only the first 25–50% of steps, which is where structure and limbs get decided, then hand the rest to a cheap finish. Same benefit, far less compute.etaands_noise- ancestral (Euler-A style) noise on the main steps. 0 means deterministic. Bumpetafor a bit more variation;s_noiseis "leave at 1.0" per the tooltip.distance_step_eta- the same ancestral idea, but for the internal distance steps. Experimental; the tooltip suggests a low value like 0.25 if you try it.
The knobs the author warns you off:
smooth- "Not recommended, will make everything brighter. Not smoother." That's a direct quote. Don't.sharpen- "Not recommended, attempts to sharpen the results but instead tends to make things fuzzy." Also don't.perp_step- "Experimental, not yet recommended."
The deep end: use_softmax swaps the min/max-normalized weighting for a softmax; eta_first/eta_last and distance_eta_first/distance_eta_last let you gate the ancestral settings to step ranges the same way distance_first/distance_last gate the main logic. Plus resample, resample_end, and cfgpp, which behave exactly as in the simple node - cfgpp still defaults true and still wants a low CFG.
A default that's a trap
Here's the thing people miss: this node is not the same config as the "Distance" sampler in your KSampler dropdown. The dropdown presets ship with cfgpp=false, use_slerp=true, and a taper down to Heun (resample_end=1). The node defaults to cfgpp=true, use_slerp=false, and constant resampling (resample_end=-1) - meaning if you just drop it in, you're getting CFG++ behavior with the slowest, most CFG-sensitive settings. Set cfgpp=false, use_slerp=true, resample_end=1 if you want the "Distance_n"-style experience the README showcases.
Install, output, and troubleshooting
Installs exactly like its sibling - once. ComfyUI Manager search "DistanceSampler," or git clone https://github.com/Extraltodeus/DistanceSampler into custom_nodes and restart. No dependencies, no model downloads. The output is a single SAMPLER that feeds SamplerCustomAdvanced's sampler input; you supply a scheduler (the pack suggests beta or AYS). If you run into tensor shape errors, the README's fix is to uncomment the Distance_fast fallbacks in presets_to_add.py, which swap the end-of-schedule slerp for a weighted average. And yes, it's slow - that's the deal, compensate with 4–10 steps, not by giving it more.
Inputs (19)
| Name | Type | Default | Description |
|---|---|---|---|
| resample | INT | 3-1–32 | 0 all along gives Euler. 1 gives Heun. Anything starting from 2 will use the distance method. -1 will do remaining steps + 1 as the resample value. This can be pretty slow. |
| resample_end | INT | -1-1–32 | How many resamples for the end. -1 means constant. |
| cfgpp | BOOLEAN | true | Controls whether to use CFG++ sampling. When enabled, you should set CFG to a fairly low value. |
| eta | FLOAT | 0.000–32 | Controls the ancestralness of the main sampler steps. 0.0 means to use non-ancestral sampling. Note: May not work well with some of the other options. |
| s_noise | FLOAT | 1.00-100–100 | Scale factor for ancestral noise added during sampling. Generally should be left at 1.0 and only has an effect when ancestral sampling is used. |
| distance_step_eta | FLOAT | 0.000–32 | Experimental option that allows using ancestral sampling for the internal distance steps. When used, should generally be a fairly low value such as 0.25. 0.0 means to use non-ancestral sampling for the internal distance steps. |
| distance_step_s_noise | FLOAT | 1.00-100–100 | Scale factor for ancestral noise added in the internal distance steps. Generally should be left at 1.0 and only has an effect when distance_step_eta is non-zero. |
| use_softmax | BOOLEAN | false | Rather than using a min/max normalization and an exponent will use a softmax instead. |
| use_slerp | BOOLEAN | false | Will SLERP the predictions instead of doing a weighted average. The difference is more obvious when using use_negative. |
| perp_step | BOOLEAN | false | Experimental, not yet recommended. |
| use_negative | BOOLEAN | false | Will use the negative prediction to prepare the distance scores. This tends to give images with less errors from my testing. |
| smooth | BOOLEAN | false | Not recommended, will make everything brighter. Not smoother. |
| sharpen | BOOLEAN | false | Not recommended, attempts to sharpen the results but instead tends to make things fuzzy. |
| distance_first | INT | 0-10000–10000 | First step to use distance sampling. You can use negative values to count from the end. Note: Steps are zero-based. |
| distance_last | INT | -1-10000–10000 | Last step to use distance sampling. You can use negative values to count from the end. Note: Steps are zero-based. |
| eta_first | INT | 0-10000–10000 | First step to use ancestral sampling. Only applies when ETA is non-zero. You can use negative values to count from the end. Note: Steps are zero-based. |
| eta_last | INT | -1-10000–10000 | Last step to use ancestral sampling. Only applies when ETA is non-zero. You can use negative values to count from the end. Note: Steps are zero-based. |
| distance_eta_first | INT | 0-10000–10000 | First step to use ancestral sampling for the distance steps. Only applies when distance ETA is non-zero. You can use negative values to count from the end. Note: Steps are zero-based. |
| distance_eta_last | INT | -1-10000–10000 | Last step to use ancestral sampling for the distance steps. Only applies when distance ETA is non-zero. You can use negative values to count from the end. Note: Steps are zero-based. |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| SAMPLER | SAMPLER | — |