Nodes/RES4LYF/LatentPhaseMagnitude
ComfyUI Node Runs on cloud

LatentPhaseMagnitude

Blend two latents by structure and by texture, separately

By ClownsharkBatwing·Created 2 years ago·Updated 21 days ago· 1,222
LatentPhaseMagnitude
  • latent_0_batch
  • latent_1_batch
  • phase_mix_powers
  • magnitude_mix_powers
  • phase_luminositys
  • phase_cyan_reds
  • phase_lime_purples
  • phase_pattern_structures
  • magnitude_luminositys
  • magnitude_cyan_reds
  • magnitude_lime_purples
  • magnitude_pattern_structures
  • latent
phase_mix_power1.000
magnitude_mix_power1.000
phase_luminosity0.000
phase_cyan_red0.000
phase_lime_purple0.000
phase_pattern_structure0.000
magnitude_luminosity0.000
magnitude_cyan_red0.000
magnitude_lime_purple0.000
magnitude_pattern_structure0.000
latent_0_normaltrue
latent_1_normaltrue
latent_out_normaltrue
latent_0_stdizetrue
latent_1_stdizetrue
latent_out_stdizetrue
latent_0_meancentertrue
latent_1_meancentertrue
latent_out_meancentertrue

Split any signal into a frequency decomposition and you get two independent things back: magnitude (how much energy is at each frequency - roughly, texture and contrast) and phase (where that energy sits - roughly, structure and shape). It's a classic signal-processing trick, and the classic demo of it is swapping the phase of one image onto the magnitude of another: the result reads structurally like the phase donor, even though none of its texture survived. LatentPhaseMagnitude applies that idea to a pair of ComfyUI latents, letting you dial in per-channel how much of each latent's phase and magnitude survives into the output.

RES4LYF's README describes a style-transfer feature built around exactly this kind of decomposition - pulling structure from one source and character from another. This node, and its three siblings (LatentPhaseMagnitudeMultiply, LatentPhaseMagnitudeOffset, LatentPhaseMagnitudePower), are the low-level tooling that makes that possible. This one is the "combine two latents" member of the family; the other three each operate on a single latent instead.

How it works

Both latent_0_batch and latent_1_batch get decomposed into phase and magnitude, per channel - luminosity, cyan-red, lime-purple, and pattern-structure, the four channels of a standard SD/SDXL-style latent. A dozen-plus float parameters (phase_luminosity, magnitude_cyan_red, and so on) then control how much of each channel's phase and magnitude come from latent 0 versus latent 1, with phase_mix_power and magnitude_mix_power as global exponents over the whole mix. Six boolean toggles (latent_0_normal, latent_1_normal, latent_out_normal, plus the matching _stdize and _meancenter sets) control normalization on the way in and out - worth leaving at their defaults (all true) until you have a specific reason to touch them.

The inputs and outputs that matter

  • latent_0_batch / latent_1_batch - the two latents you're blending.
  • The per-channel phase_* and magnitude_* floats - these are the actual mix controls, one pair per channel. Push a channel's phase toward one source and its magnitude toward the other to genuinely separate structure from texture.
  • phase_mix_power / magnitude_mix_power - global exponents over the mix; leave at 1 for a linear blend.
  • Optional per-channel SIGMAS variants (phase_luminositys, magnitude_cyan_reds, etc.) - schedule any of the above across steps instead of a fixed value.
  • Output: latent - a single blended latent.

How to install it

Through ComfyUI Manager: search "RES4LYF" and install. Or manually, from ComfyUI/custom_nodes:

git clone https://github.com/ClownsharkBatwing/RES4LYF/
cd RES4LYF
pip install -r requirements.txt

Activate your venv first if you use one; on portable builds, use python_embedded\Scripts\pip.exe in place of pip. Restart ComfyUI afterward.

Common issues & troubleshooting

Results look muddy instead of like a clean blend. Leave the normalize/stdize/meancenter booleans at their defaults first - this pack ships them true for a reason, and turning them off before you understand the baseline behavior makes it much harder to tell what your phase/magnitude values are actually doing.

Nothing seems to change. This is a genuinely deep, undocumented corner of the pack - there's no written guide to what "good" per-channel values look like beyond the parameter names. Start by pushing one channel's mix hard toward 0 or hard toward 1 (rather than nudging fractionally) so you can actually see which channel controls what before fine-tuning.

You only have one latent, not two. If you're trying to reshape a single latent's own phase/magnitude rather than blend two together, this isn't the node - use LatentPhaseMagnitudeMultiply, LatentPhaseMagnitudeOffset, or LatentPhaseMagnitudePower instead, all of which take a single latent_0_batch.

CategoryRES4LYF/latents

Inputs (31)

NameTypeDefaultDescription
latent_0_batchLATENT
latent_1_batchLATENT
phase_mix_powerFLOAT1.000-10000–10000
magnitude_mix_powerFLOAT1.000-10000–10000
phase_luminosityFLOAT0.000-10000–10000
phase_cyan_redFLOAT0.000-10000–10000
phase_lime_purpleFLOAT0.000-10000–10000
phase_pattern_structureFLOAT0.000-10000–10000
magnitude_luminosityFLOAT0.000-10000–10000
magnitude_cyan_redFLOAT0.000-10000–10000
magnitude_lime_purpleFLOAT0.000-10000–10000
magnitude_pattern_structureFLOAT0.000-10000–10000
latent_0_normalBOOLEANtrue
latent_1_normalBOOLEANtrue
latent_out_normalBOOLEANtrue
latent_0_stdizeBOOLEANtrue
latent_1_stdizeBOOLEANtrue
latent_out_stdizeBOOLEANtrue
latent_0_meancenterBOOLEANtrue
latent_1_meancenterBOOLEANtrue
latent_out_meancenterBOOLEANtrue
phase_mix_powersoptSIGMAS
magnitude_mix_powersoptSIGMAS
phase_luminositysoptSIGMAS
phase_cyan_redsoptSIGMAS
phase_lime_purplesoptSIGMAS
phase_pattern_structuresoptSIGMAS
magnitude_luminositysoptSIGMAS
magnitude_cyan_redsoptSIGMAS
magnitude_lime_purplesoptSIGMAS
magnitude_pattern_structuresoptSIGMAS

Outputs (1)

NameTypeDescription
latentLATENT