H3 Auto Refs (folders, by prompt)
Character folders in, matched reference photos out, no manual wiring
- ref_1
- ref_2
- ref_3
- ref_4
- ref_5
- ref_6
- ref_7
- ref_8
- ref_9
- prompt_out
- report
- refs_batch
- found
If you've ever run a multi-character H3 scene and watched everyone render as the same person, this node is the fix you wanted. H3AutoRefs looks at your script text, figures out which characters are actually in it, and pulls their reference photos from per-character folders automatically - no manual wiring of nine image loaders, no "which ref goes in which slot" bookkeeping.
The mechanism is clean. You keep a refs_root folder with one subfolder per character (input/h3_refs/rae/, input/h3_refs/mark/, …). The node scans the prompt text for folder names as whole words - dialogue is stripped first, so a character who's merely talked about never accidentally matches - then each matched character contributes up to max_per_character images (default 3, and the tooltip's advice to sort for front/three-quarter/profile sets is genuinely good; that set holds identity best). Everything stays under H3's 9-reference-slot cap, and the matching <Picture N> identity lines are generated and prepended to the prompt automatically. That last part is the real time-saver: it's the binding text that tells the model which photo is which subject, and getting it wrong is exactly how refs blend into one averaged face.
The inputs that matter
prompt_text- the text scanned for character names (the premise, or the writer's output).extra_text- a second text to scan. Wire the scene idea here so a writer that renames the character toID_Astill casts the right photos.characters- explicit comma list of folders; overrides the prompt scan entirely when set. This is your control when the scan over-matches.overrides- folder remaps likerae=rae_nightto swap a character's ref set for specific scenes.enabled- the master switch (wire USE AUTO REFS here). Off means no scan, no photos,found=false, run continues.on_no_match-no_reference(default) warns and renders without photos;errorstops the run.
Outputs: ref_1 through ref_9 (the picked photos, one per slot), plus refs_batch (all of them in one batch, so two or three matched characters don't overflow a 3-slot chain), prompt_out (the prompt with identity bindings prepended), report, and found - a boolean you can feed to the writer so it knows whether to say "looks like the person in the photos" or describe them from prose. An earlier version had a subtle trap where the scan stopped at the first three characters it found; that's fixed - it now scans up to nine and splits the reference slots across everyone who matched.
Install
Part of the H3 Multishot pack:
cd ComfyUI/custom_nodes
git clone https://github.com/jlucasmcrell/ComfyUI-H3-Multishot
or ComfyUI-Manager → H3 Multishot. Restart, ComfyUI v0.30.0+, no extra dependencies. Models go in the usual spots: the checkpoint in models/diffusion_models/, encoder and VAEs in text_encoders/ and vae/.
The honest caveat is the same one the whole ref system carries: fewer characters per run holds faces more firmly. Five named characters all get a photo, but a two-character scene will hold better. If identity is the whole job, keep the cast small and give everyone three good angles.
Inputs (8)
| Name | Type | Default | Description |
|---|---|---|---|
| max_per_character | INT | 31–9 | Images per matched character (sorted order; front/three-quarter/profile sets hold identity best). |
| prompt_textopt | STRING | Text scanned for character folder names (the premise, or the writer's output). | |
| refs_rootopt | STRING | Folder holding one subfolder per character. Relative paths resolve under input/. Empty = input/h3_refs/. | |
| charactersopt | STRING | Explicit comma list of character folders - overrides the prompt scan entirely when set. | |
| overridesopt | STRING | Folder remaps, e.g. 'rae=rae_night' to swap a character's ref set for specific scenes. Comma-separated. | |
| on_no_matchopt | COMBO | no_reference | no_reference (default) = warn in the console and render WITHOUT photos when no character folder matches; the writer is told (found=false) and describes the person normally. error = stop the run instead. |
| enabledopt | BOOLEAN | Wire USE AUTO REFS here. Off = no scan, no photos, found=false, and the run continues. | |
| extra_textopt | STRING | Optional second text to scan for character folder names - wire the scene idea / premise here so a writer that renames the character to ID_A still casts the right photos. |
Outputs (13)
| Name | Type | Description |
|---|---|---|
| ref_1 | IMAGE | — |
| ref_2 | IMAGE | — |
| ref_3 | IMAGE | — |
| ref_4 | IMAGE | — |
| ref_5 | IMAGE | — |
| ref_6 | IMAGE | — |
| ref_7 | IMAGE | — |
| ref_8 | IMAGE | — |
| ref_9 | IMAGE | — |
| prompt_out | STRING | — |
| report | STRING | — |
| refs_batch | IMAGE | — |
| found | BOOLEAN | — |