TdxhReference
Reference-only conditioning with a switch — bring your own helper pack
- main_latent
- pixels
- vae
- model
- MODEL
- LATENT
TdxhReference wraps the old reference_only conditioning technique into a single switchable node. "Reference-only" is the SD1.5/SDXL-era way of borrowing from a reference image: you VAE-encode the reference into a latent, inject it into the model's attention during sampling, and the output picks up the reference's composition, color, and general vibe without copying it pixel-for-pixel. It's a one-image form of style/composition transfer - the ancestor of the adapter tricks people use today.
The node's job: when bool_int is 1, it VAE-encodes your pixels into a reference latent, then runs ReferenceOnlySimple from the ComfyUI_experiments project, passing your model, the reference latent, and a batch_size. Outputs are MODEL and LATENT. When bool_int is 0, it skips all of that and passes your model and main_latent straight through. So in a graph it's a drop-in that either applies the reference or behaves like a plain pass-through - one switch toggles between "plain generation" and "generation influenced by this reference."
Now the gotcha, and it's a big one: this node doesn't ship the reference-only implementation. It looks for ComfyUI_experiments in your custom_nodes folder, or a file named reference_only.py sitting directly in custom_nodes. If neither is there and you flip the switch on, you get a hard RuntimeError: "You must install custom_nodes: ComfyUI_experiments or provide reference_only.py!" - the node is genuinely two installs, and the README only hints at it. Install ComfyUI_experiments from the ComfyUI community list (it's a well-known older pack) and you're set.
Other inputs: main_latent (your normal latent, from EmptyLatentImage), pixels (the reference image), vae, model, and batch_size (1–64, for repeating the reference across a batch). The outputs wire back into your sampler chain like stock - MODEL to the KSampler, LATENT to the latent slot.
Installing it
Two steps. First the pack:
cd ComfyUI/custom_nodes
git clone https://github.com/youyegit/tdxh_node_comfyui
Then the dependency it won't run without:
git clone https://github.com/comfyanonymous/ComfyUI_experiments
(ComfyUI Manager can install both - search tdxh_node_comfyui and ComfyUI_experiments.) Restart and the node is under TDXH → tdxh_efficiency.
The honest take
Reference-only is a classic technique, but it's dated - the KB's own character-consistency material notes the approach got rerouted into instruction-editing and adapters. If you're on SDXL and already use ComfyUI_experiments, this node makes the reference switchable and that's legitimately convenient. If you're starting fresh, IP-Adapter does the same job better and is better supported. Either way, don't install TdxhReference without its helper pack - that RuntimeError will greet you otherwise.
Inputs (6)
| Name | Type | Default | Description |
|---|---|---|---|
| bool_int | INT | 10–1 | — |
| main_latent | LATENT | — | |
| pixels | IMAGE | — | |
| vae | VAE | — | |
| model | MODEL | — | |
| batch_size | INT | 11–64 | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| MODEL | MODEL | — |
| LATENT | LATENT | — |