Nodes/ComfyUI LC123 Nodes/LC Flux 3 Reference Latent 🖼️
ComfyUI Node

LC Flux 3 Reference Latent 🖼️

Four reference images, one node

By lonecatone23·Created 3 months ago·Updated about 15 hours ago· 46
LC Flux 3 Reference Latent 🖼️
  • positive
  • vae
  • image_1
  • image_2
  • image_3
  • image_4
  • negative
  • clip
  • positive
  • negative
  • latent
  • width
  • height
◄modeldistilled (cfg 1)►
◄reference_size1 MP►
◄width0►
◄height0►

Why you'd reach for it

Reference-based FLUX 3 work is normally a five-node ritual: encode the prompt, load and VAE-encode each reference, splice reference_latents into both conditioning streams, build the right negative for whichever variant you loaded, then make an empty latent at the right size. It's the sort of graph you copy from someone else's workflow and never fully understand.

This node collapses it. Wire your encoded prompt, a VAE and up to four images and you get back positive conditioning, negative conditioning, a latent and the output dimensions. No references connected? It degrades into a plain text-to-image setup instead of erroring, which makes it a reasonable default in a template.

How it works

Each image is cropped to three channels, resized (lanczos, rounded to a multiple of 16) to your reference_size, and VAE-encoded. The resulting latents are attached to the conditioning under the reference_latents key - and attached to both positive and negative, because that's how the architecture expects references to be carried through classifier-free guidance. Skip the negative and you get the classic "references only half applied" look.

The negative itself is the detail that actually matters. FLUX 3 Distilled runs at CFG 1, so it wants a zeroed version of your positive conditioning - same structure, all values zero. Flux 3 Base runs at CFG 3.5 and wants a real empty-prompt encoding, which means it needs the CLIP and can't fake it from the positive alone. Pick the wrong variant in model and nothing crashes: you just get a worse image and no idea why. That's the trap on this node, and it's the reason the enum exists rather than an automatic guess.

Then the latent. If your output dimensions match picture 1, the node hands you a zero tensor with the reference's own shape, which is the cheap path. Otherwise it builds an empty Flux-family latent at the size you asked for. Either way the width and height you set are snapped down to the nearest multiple of 16, so 1348 becomes 1344.

The inputs that matter

  • positive - your encoded prompt, from any CLIP Text Encode.
  • vae - the FLUX 3 VAE. It does the encoding and it has to be the matching one.
  • model - distilled (cfg 1) or base (cfg 3.5). This sets the negative when you don't wire one.
  • reference_size - 1 MP, 2 MP, 4 MP or keep size. Each reference is scaled to this many megapixels with its shape preserved. BFL keeps references at native size; the docstring is refreshingly honest that keep size is more detail and slower.
  • width / height - result size. 0 means "picture 1's size", or 1024 with no pictures at all.
  • image_1…image_4 - the references. They map to <ref_image_0> through <ref_image_3> in your prompt, so the order you plug them in is the order the model reads them.
  • negative / clip - wire your own negative to override the built-in one; clip is only needed for Base without a negative, where it encodes the empty prompt.

What comes out

positive and negative go into the sampler's conditioning sockets, latent into its latent socket, and width / height are integers you can feed to a save node, a resize, or an LC Size Pad comparison. The node raises a clear error if you've picked Base and left clip unconnected - better than the silent alternative.

Install

ComfyUI Manager → ComfyUI LC123 Nodes, or:

cd ComfyUI/custom_nodes
git clone https://github.com/lonecatone23/ComfyUI_LC123_nodes

No requirements.txt, no model downloads, no pip step - this node needs only what core ComfyUI already imports. Restart and check the console for [LC123] + lines. The FLUX 3 Klein weights, text encoder and VAE are separate installs; this pack doesn't fetch models.

Common issues

References barely register. Nine times out of ten the model enum doesn't match the checkpoint you loaded. Distilled at CFG 1 with a CFG-3.5 negative (or the reverse) produces images that look plausibly fine until you compare with references off.

"Base needs a negative: connect the clip." Exactly what it says. Either wire the CLIP so it can encode the empty prompt, or wire your own negative conditioning.

Barely fits in VRAM, generation crawls. keep size and 4 MP both cost you, and if you're running FLUX 3 Base at CFG 3.5, you're doing two forward passes per step on top of it. Drop to 1 MP first; references at 1 MP are still a lot of conditioning.

Sizes come back off by a few pixels. Steps of 16. 1920 × 1080 becomes 1920 × 1072, and that's the node being polite to the model rather than a bug.

Alpha in a reference is ignored. Images are cropped to RGB before encoding, so a transparent PNG's cut-out shape doesn't survive. Bake it onto a background first.

CategoryLC123/Flux 3

Inputs (12)

NameTypeDefaultDescription
positiveCONDITIONINGThe encoded prompt.
vaeVAE—
modelCOMBOdistilled (cfg 1)Sets the negative when none is connected: distilled = the zeroed prompt, Base = an empty prompt (needs the clip).
reference_sizeCOMBO1 MPEach reference picture is scaled to this many megapixels (shape kept). BFL keeps references at their own size: more detail, slower.
widthINT00–16384Size of the result. 0 = the size of picture 1 (1024 when there is none).
heightINT00–163840 = the size of picture 1.
image_1optIMAGE<ref_image_0> in the prompt.
image_2optIMAGE<ref_image_1>.
image_3optIMAGE<ref_image_2>.
image_4optIMAGE<ref_image_3>.
negativeoptCONDITIONINGYour own negative. Empty = set by model.
clipoptCLIPOnly for Base without a negative: encodes the empty prompt.

Outputs (5)

NameTypeDescription
positiveCONDITIONING—
negativeCONDITIONING—
latentLATENT—
widthINT—
heightINT—