Nodes/ComfyUI-layerdiffuse (layerdiffusion)/Layer Diffuse Cond Joint Apply
ComfyUI Node Runs on cloud

Layer Diffuse Cond Joint Apply

The blend plus the missing layer

By huchenlei·Created 2 years ago·Updated about a year ago· 1,777
Layer Diffuse Cond Joint Apply
  • model
  • image
  • cond
  • blended_cond
  • MODEL
config

LayeredDiffusionCondJointApply is the "give me everything at once" version of the conditioning nodes, and it's firmly SD 1.5 territory. Give it one layer and it produces the other two in a single sampler run: feed it a foreground image and you get back the blended composite and the background; feed it a background and you get the blend and the foreground. One generation, three layers resolved, two of them new.

The cost of "joint": batch size

The trade-off is right in the config name - SD15, Foreground, attn_sharing, Batch size (2N) (and the Background twin). This node patches your model with an attention-sharing wrapper that lays down two latent images per group: your input-derived one and the generated companion. That means your EmptyLatentImage batch must be a multiple of 2 (2N, not N). Set it to 2 and you get one group of two outputs; set it to 4 and you get two groups.

That's also why the decode step matters. The pack's example workflows (layer_diffusion_cond_joint_fg.json, layer_diffusion_cond_joint_bg.json) finish with LayeredDiffusionDecodeSplit set to frames: 2 - it RGBA-decodes every 2nd image in the batch so the foreground comes out with alpha while the companion layer passes through as plain RGB. Skip that and you've got a mystery batch of latents.

Inputs

  • model - your SD 1.5 checkpoint.
  • image (IMAGE) - the foreground or background you already have. This is a straight image input (not a latent - the node handles the encode via a control path in the attention-sharing patch), unlike the SDXL CondApply node which takes an encoded latent.
  • config - SD15, Foreground, attn_sharing, Batch size (2N) → generates Blended + BG from your FG; SD15, Background, ... → generates Blended + FG from your BG.
  • cond and blended_cond (optional CONDITIONING) - prompts for the generated layer and the blend. Leave them empty and it falls back to defaults; wire them in if you want to steer what gets generated.

Output: a single MODEL (with the attention-sharing patch and your cond overrides baked in), straight into the KSampler.

Realistic expectations

This is the most "experimental" corner of an already-dormant pack. These joint nodes were added in March 2024, the README notes they're SD 1.5-only, and the batch-multiple requirement trips people up constantly - the single biggest failure mode is feeding it a batch size that isn't 2N and getting garbled groups. Standard family caveats apply: 64-multiple dimensions, +2–3GB VRAM, and the whole project has been frozen since early 2025 with no Flux-era successor. When it lands, you get three consistent layers from one pass, which is genuinely useful for compositing; when it doesn't, check the batch size first.

Categorylayer_diffuse

Inputs (5)

NameTypeDefaultDescription
modelMODEL
imageIMAGE
configCOMBO2 options: SD15, Foreground, attn_sharing, Batch size (2N), SD15, Background, attn_sharing, Batch size (2N)
condoptCONDITIONING
blended_condoptCONDITIONING

Outputs (1)

NameTypeDescription
MODELMODEL