ComfyUI-Advanced-Latent-Control
This custom node helps to transform latent in different ways.
Custom Nodes
Latent mirror
This node can flip latent and merge original and flipped version
Input:
latent
Fields:
direction– can bevertically,horizontallyorbothmultiplier– multiply latent by specified number
Output:
latent
Latent shift
This node can shift latent along x and y axes
Input:
latent
Fields:
x_shift– a number between -1 and 1 that indicates how much the latent should be shiftedy_shift– a number between -1 and 1 that indicates how much the latent should be shifted
Output:
latent
TSampler with transforms (Latent Control)
This node can multiply, mirror and shift latent during generation
Input:
exactly matches the base KSampler
Fields:
- base KSampler fields
start_mirror_at– a number between 0 and 1 that indicates at what point the sampler will start mirroringstop_mirror_at– a number between 0 and 1 that indicates at what point the sampler will stop mirroringmirror_mode– can bereplaceorcombine.replacewill replace the latent with the transformed one,combinewill add the original and the transformed latent and divide by 2mirror_direction– can benone,vertically,horizontally,both,90 degree rotationor180 degree rotationstart_shift_at– a number between 0 and 1 that indicates at what point the sampler will start shiftingstop_shift_at– a number between 0 and 1 that indicates at what point the sampler will stop shiftingshift_mode– can bereplaceorcombine.replacewill replace the latent with the transformed one,combinewill add the original and the transformed latent and divide by 2x_shift– a number between -1 and 1 that indicates how much the latent should be shiftedy_shift– a number between -1 and 1 that indicates how much the latent should be shiftedstart_multiplier_at– a number between 0 and 1 that indicates at what point the sampler will start multiplyingstop_multiplier_at– a number between 0 and 1 that indicates at what point the sampler will stop multiplyingmultiplier_mode– can bereplaceorcombine.replacewill replace the latent with the transformed one,combinewill add the original and the transformed latentmultiplier– multiply latent by specified number
Output: exactly matches the base KSampler
Usage:
You also can use those params together




TSampler (Latent Control)
This node allows to combine a lot of transforms with different parameters
Input:
- base KSampler fields
- transform_optional – field that can take output from one of those nodes:
Mirror transform,Shift transform,Multiply transformorCombine transforms
Fields: exactly matches the base KSampler
Output: exactly matches the base KSampler
Multiply, Mirror and Shift transform nodes parameters exactly match the corresponding KSampler with transforms (Latent Control) parameters
There are two new transform nodes:
- Latent add
- Latent interpolate
They work exactly the same as LatentAdd and LatentBlend nodes from standard node pack, but also, can multiply result by specified number.
Offset
You can apply specific offset for transform nodes.
Fields:
process_every– a number that indicates which steps will be processedoffset– a number that indicates offset for previous parameter. For example: ifprocess_everyis 4 andoffsetis 0, sampler apply transformation with this pattern: 0 0 0 1. This pattern will repeat again and again. Ifoffsetis 2, pattern will be 0 1 0 0, if -1 – 1 0 0 0.mode– can beprocess_everyorskip_every. For example, withskip_everyprevious pattern (0 0 0 1) turn into this: 1 1 1 0
Output:
offset
You can combine different offsets to achieve interesting patterns. For example:
0 0 0 1 and 0 0 1 give this pattern 0 0 1 1 0 1 0 1 1 0 0 1
One time nodes
Each transform node has own one-time version. They allow to make one transform action at specified step.
Latent normalize
Input
exactly matches the VAE Decode node
Output
- latent
When you multiply latent by negative or big positive (bigger than 2) number and paste this latent in sampler, you can see that the image will be generated very poorly. This is because stable diffusion cannot work with such set of numbers (meaning the numbers contained in latent).
But you can prevent this behavior by sequential decode and encode latent using vae. Node Latent normalize make this process easier.
This node also change some results even if output without this node looks good.
And it very slightly changes results from latent, which have not been modified.














