Nodes/ComfyUI-UtilsCollection/Advanced Visual Conditioning Encode (TokenFusion)
ComfyUI Node

Advanced Visual Conditioning Encode (TokenFusion)

Token fusion for the advanced visual encoder

By silveroxides·Created 2 months ago·Updated about 7 hours ago· 24
Advanced Visual Conditioning Encode (TokenFusion)
  • clip
  • image_inputs
  • visual_fusion_config
  • vae
  • CONDITIONING
prompt
system_prompt
vlm_resolution384
formula
padding_methodzero-pad
vae_resolutionFast (1024)
ref_latent_modeoff
multiplier1.0
vae_dimension_multiple8
semantic_anchorfalse

UC_AdvancedVisualConditioningEncode is the toolbox; this is the same toolbox with a different fusion philosophy bolted on. UC_AdvancedVisualConditioningEncodeTokenFusion ("Advanced Visual Conditioning Encode (TokenFusion)") takes the full advanced schema - fusion config, resolution dial, formula, padding, reference latents, semantic anchors - and swaps the way visual sources are combined: instead of spatially fusing complete images, it fuses per-source visual tokens into one stream before the conditioning encode. Same inputs, same single CONDITIONING output, different fusion stage.

What's different

The schemas are effectively identical, and the tooltips mirror each other exactly: clip, prompt, system_prompt, vlm_resolution, formula, padding_method, vae_resolution, ref_latent_mode, multiplier, vae_dimension_multiple, semantic_anchor, image_inputs, plus optional visual_fusion_config and vae. Output is one CONDITIONING.

The difference lives in the _TokenFusionConditioningNode execution path. When fusion is active, the node flattens the connected images, merges their visual tokens into a single token stream, and runs one conditioning encode on that combined stream - rather than encoding each image separately and merging the results. That's the "TokenFusion" in the name, and it's the same additive token-first approach the VisCon TokenFusion encoder uses, applied to this single-encoder node.

Two behaviors from the code that'll save you confusion:

  1. Graceful fallback. If fusion is off or no images are connected, the node transparently executes its base node's ordinary path instead of erroring. A disconnected TokenFusion node is just a normal encoder - which makes it safe to drop into a workflow while you're still deciding.
  2. The H3 guard. If your CLIP is a MiniMax H3 text encoder and ref_latent_mode isn't off, it raises a clear error telling you to use Core's dedicated H3 reference conditioning instead. Read the error, set it to off, move on.

Everything else - the image_input_N inline placeholders with fusion off, image_input_fusion with fusion on, <Picture N> semantic anchors, the formula field that only matters when fusion is off - follows the same contract as its sibling.

Install

Via ComfyUI Manager (search ComfyUI-UtilsCollection) or:

cd ComfyUI/custom_nodes
git clone https://github.com/silveroxides/ComfyUI-UtilsCollection

Restart. Deps: opencv-python and typing-extensions.

When you'd reach for it

When your reference images are close in meaning and you want them fused into one coherent token context rather than merged as complete images - the same "fuse the ingredients vs. fuse the finished pictures" choice the VisCon family offers. If your sources are diverse or fighting each other, the plain (spatial) variant may serve you better. Both are experimental; both are cheap to compare side by side.

Categoryadvanced/conditioning

Inputs (14)

NameTypeDefaultDescription
clipCLIPCLIP/T5 dual text encoder reference.
promptSTRINGMain prompt. With fusion off, image_input_N places active image N inline. With fusion on, use image_input_fusion (image_input_1 is accepted as an alias).
system_promptSTRINGSystem prompt injected prior to user description.
vlm_resolutionINT3840–4096Equivalent-square VLM target from 256 to 3584. Values outside that range preserve original resolution.
formulaSTRINGOptional formula used only with fusion off when no numbered inline placeholders are present. Empty selects the first image pass.
padding_methodCOMBOzero-padAlignment method for images with different aspect ratios/resolutions. Active ONLY if visual_fusion_config is disconnected or set to 'off'.
vae_resolutionCOMBOFast (1024)Resolution of the reference latent encoded by the VAE (structural path).
ref_latent_modeCOMBOoffReference latent encoding mode. 'single'/'multi' append latents; 'parallel-single'/'parallel-multi' run them in a separate conditioning stream to prevent semantic override.
multiplierFLOAT1.0-1000–1000Overall multiplier applied to the final conditioning vector.
vae_dimension_multipleINT84–256Pixel multiple used to align reference images before VAE encoding.
semantic_anchorBOOLEANfalsePrefixes each encoded visual slot with its numbered <Picture N>: semantic anchor.
image_inputsCOMFY_AUTOGROW_V3Multimodal images. Maps active inputs sequentially to variables (a, b, c, ...).
visual_fusion_configoptVISUAL_FUSION_CONFIGOptional spatial visual fusion configuration from UC_VisualFusionConfig. Blends isolated visual blocks without coordinate blur.
vaeoptVAE

Outputs (1)

NameTypeDescription
CONDITIONINGCONDITIONING