[Inference.Core] Layer Diffuse Cond Apply
Generating matching foreground and background layers
- model
- cond
- uncond
- latent
- MODEL
- CONDITIONING
- CONDITIONING
Plain Layer Diffuse Apply gives you one transparent layer generated in isolation - great for a clean cutout, but the layer has no idea what it's eventually going to sit on top of. Cond Apply is the node for when that matters: it generates a foreground layer and a background layer as a coordinated pair, so the lighting, color grade, and composition actually agree with each other when you composite them back together, instead of two independently-plausible images glued into an obviously-fake stack.
How the pairing works
This is the SDXL side of Layer Diffuse's paired generation (Lvmin Zhang's SIGGRAPH 2024 technique, ported to ComfyUI by huchenlei and bundled into this pack under the Inference_Core_ prefix). You run it twice - once per layer - and the two runs share information through the conditioning. Set config to SDXL, Foreground for your foreground pass and SDXL, Background for the other, each with its own prompt (cond), negative prompt (uncond), and latent (the empty/noise latent for that pass, same as you'd feed a KSampler directly). The node hands back a patched MODEL plus two CONDITIONING outputs - the fused positive and negative - for that pass's sampler.
weight (-1 to 3, default 1) controls how strongly the transparency patch itself is applied, same as in plain Apply - it's not the knob for how strongly the two layers influence each other, just how aggressively each individual layer gets the alpha-channel treatment.
Practical wiring
Run this node twice, once configured for each layer, feeding each pass's own model/cond/uncond/latent. Wire the MODEL output into that pass's KSampler, and the two CONDITIONING outputs into its positive and negative slots. Sample both, then decode each layer (Inference_Core_LayeredDiffusionDecode) to pull out the actual RGB-plus-alpha result. This is meaningfully more setup than plain Apply - two full sampling passes instead of one - so reach for it specifically when the two layers actually need to agree with each other, not as a default replacement for the simpler node.
The fusion helps consistency, it doesn't invent it out of nothing: if your foreground and background prompts describe two completely unrelated scenes, the layers will still composite awkwardly even with this node's help. Write both prompts as if they're describing the same scene from each layer's side - same lighting conditions, same rough setting - and let Cond Apply handle keeping them visually glued together.
Installing it
Bundled with the pack - install via ComfyUI Manager (search "ComfyUI-Inference-Core-Nodes") or 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] for your hardware) and restart. Expect a first-run download of Layer Diffuse's conversion weights from Hugging Face, same as with any node in this family.
Where it goes wrong
Config/checkpoint mismatch is still the sharpest edge - this node is SDXL-only, so run it against an SD1.5 checkpoint and you'll get an immediate crash rather than a subtle quality issue. Beyond that, the most common disappointment is people expecting the two-pass fusion to fix incoherent prompts on its own; it smooths lighting and composition agreement, it doesn't reconcile a foreground prompt and background prompt that are describing different worlds. If your composited result looks obviously mismatched, check the prompts before blaming the node.
Layer Diffuse overall is a real but niche technique - steady, low-volume usage in the community rather than a mainstream default - and this paired mode is the more advanced end of it. If you just need a single clean transparent cutout, plain Inference_Core_LayeredDiffusionApply is the simpler tool for that job.
Inputs (6)
| Name | Type | Default | Description |
|---|---|---|---|
| model | MODEL | — | |
| cond | CONDITIONING | — | |
| uncond | CONDITIONING | — | |
| latent | LATENT | — | |
| config | COMBO | 2 options: SDXL, Foreground, SDXL, Background | |
| weight | FLOAT | 1.00-1–3 | — |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| MODEL | MODEL | — |
| CONDITIONING | CONDITIONING | — |
| CONDITIONING | CONDITIONING | — |