Advanced Visual Conditioning Encode (TokenFusion)
Token fusion for the advanced visual encoder
- clip
- image_inputs
- visual_fusion_config
- vae
- CONDITIONING
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:
- Graceful fallback. If fusion is
offor 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. - The H3 guard. If your CLIP is a MiniMax H3 text encoder and
ref_latent_modeisn'toff, it raises a clear error telling you to use Core's dedicated H3 reference conditioning instead. Read the error, set it tooff, 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.
Inputs (14)
| Name | Type | Default | Description |
|---|---|---|---|
| clip | CLIP | CLIP/T5 dual text encoder reference. | |
| prompt | STRING | Main 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_prompt | STRING | System prompt injected prior to user description. | |
| vlm_resolution | INT | 3840–4096 | Equivalent-square VLM target from 256 to 3584. Values outside that range preserve original resolution. |
| formula | STRING | Optional formula used only with fusion off when no numbered inline placeholders are present. Empty selects the first image pass. | |
| padding_method | COMBO | zero-pad | Alignment method for images with different aspect ratios/resolutions. Active ONLY if visual_fusion_config is disconnected or set to 'off'. |
| vae_resolution | COMBO | Fast (1024) | Resolution of the reference latent encoded by the VAE (structural path). |
| ref_latent_mode | COMBO | off | Reference latent encoding mode. 'single'/'multi' append latents; 'parallel-single'/'parallel-multi' run them in a separate conditioning stream to prevent semantic override. |
| multiplier | FLOAT | 1.0-1000–1000 | Overall multiplier applied to the final conditioning vector. |
| vae_dimension_multiple | INT | 84–256 | Pixel multiple used to align reference images before VAE encoding. |
| semantic_anchor | BOOLEAN | false | Prefixes each encoded visual slot with its numbered <Picture N>: semantic anchor. |
| image_inputs | COMFY_AUTOGROW_V3 | Multimodal images. Maps active inputs sequentially to variables (a, b, c, ...). | |
| visual_fusion_configopt | VISUAL_FUSION_CONFIG | Optional spatial visual fusion configuration from UC_VisualFusionConfig. Blends isolated visual blocks without coordinate blur. | |
| vaeopt | VAE | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| CONDITIONING | CONDITIONING | — |