Nodes/ComfyUI-Inference-Core-Nodes/[Inference.Core] Layer Diffuse Diff Apply
ComfyUI Node

[Inference.Core] Layer Diffuse Diff Apply

Splitting an existing composite into matching layers

By LykosAI·Created 2 years ago·Updated about a year ago· 33
[Inference.Core] Layer Diffuse Diff Apply
  • model
  • cond
  • uncond
  • blended_latent
  • latent
  • MODEL
  • CONDITIONING
  • CONDITIONING
config
weight1.00

Diff Apply is a close cousin of Inference_Core_LayeredDiffusionCondApply, and the two are easy to mix up - same job in principle (generate a foreground layer and a background layer that agree with each other), but Diff Apply adds one extra input that changes what it's actually solving: blended_latent.

What the extra input buys you

Cond Apply pairs a foreground pass and a background pass and lets them inform each other through shared conditioning - good for generating two brand-new coordinated layers from scratch. Diff Apply adds a third piece of context: the already-composited result you're trying to reproduce. That's the "diff" in the name - instead of just generating two layers that plausibly go together, the node reasons about the difference between each layer and a specific target blend, and steers generation to split that exact look into a foreground and background that recombine back into it.

Practically, this is the node for un-flattening an image you already have (or are generating alongside this pass) into editable layers. If you've already produced a finished, opaque composite you like and want a foreground cutout plus a matching background plate that reconstruct it, blended_latent is what anchors the split to that specific target rather than to a generic "these should look coherent" fusion.

Wiring it

Required inputs: model, cond, uncond, latent (that pass's own noise latent), blended_latent (the target composite, shared across both passes), config (SDXL, Foreground or SDXL, Background), and weight (-1 to 3, default 1, same transparency-patch-strength control as the rest of the family). Run it twice, once per config value, feeding the same blended_latent to both passes but each pass's own latent, cond, and uncond. Outputs are a patched MODEL plus fused CONDITIONING for cond and uncond - wire those into that pass's KSampler exactly as you would with Cond Apply.

Diff Apply vs. Cond Apply

If you're generating two brand-new layers with no pre-existing target to match, Inference_Core_LayeredDiffusionCondApply is the simpler tool - it's the same setup effort without the extra blended_latent input to source. Reach for Diff Apply specifically when there's a real target composite you're trying to decompose or reconstruct against. If you don't have a clear answer for what your blended_latent should be, that's usually a sign Cond Apply is what you actually want.

Installing it

Bundled with the pack. ComfyUI Manager: search "ComfyUI-Inference-Core-Nodes". Manually:

cd ComfyUI/custom_nodes
git clone https://github.com/LykosAI/ComfyUI-Inference-Core-Nodes

then install.py, or pip install -e .[cuda] (or [cuda12] / [rocm] / [directml] / [cpu]) and restart. As with the rest of this family, expect a one-time download of Layer Diffuse's conversion weights from Hugging Face on first use.

Troubleshooting

This node is SDXL-only, so an SD1.5 checkpoint against it will crash immediately on the tensor mismatch rather than misbehave subtly - check config against your loaded model first. Beyond that, the most common source of disappointing results is a blended_latent that doesn't actually correspond to a coherent target (noise, or a latent from an unrelated generation) - the node can only split a real composite into layers, it can't invent one. If your foreground and background come back not adding up to the target, double-check that blended_latent is genuinely the composite you meant to decompose.

Categorylayer_diffuse

Inputs (7)

NameTypeDefaultDescription
modelMODEL
condCONDITIONING
uncondCONDITIONING
blended_latentLATENT
latentLATENT
configCOMBO2 options: SDXL, Foreground, SDXL, Background
weightFLOAT1.00-1–3

Outputs (3)

NameTypeDescription
MODELMODEL
CONDITIONINGCONDITIONING
CONDITIONINGCONDITIONING