StoryDiffusion_CLIPTextEncode
Write [Taylor] wakes up — get five consistent scenes back
- clip
- switch
- image
- control_image
- positive
- negative
- condition
- width
- height
StoryDiffusion_CLIPTextEncode is where the story actually gets written. It's the pack's answer to ComfyUI's normal CLIPTextEncode: instead of one positive and one negative prompt, you feed it a cast list and a scene list, and it produces one conditioning per scene while making sure the character embeddings line up across all of them. It's not optional - StoryDiffusion_Apply and StoryDiffusion_KSampler are built around its outputs.
The format is the whole trick, and it's simple once you see it. role_text defines the characters, one line each, in square brackets:
[Taylor] a woman img, wearing a white T-shirt, blue loose hair.
[Lecun] a man img, wearing a suit, black hair.
scene_text is one line per scene, using those names - each line becomes one output image:
[Taylor] wake up in the bed
[Taylor] have breakfast by the window
[Lecun] driving a car
[Lecun] is working
Two extra conventions are worth knowing. A line starting [NC] is a scene with no character in it (no face to keep consistent), and a single line containing two character names is a dual scene - both characters in one frame, which is exactly what the msdiffusion and story_maker modes exist for. The node splits everything by lines, so don't cram multiple scenes into one line.
Inputs that matter
clip- a normal CLIP (from aCLIPLoader/ dual loader). Forstory/SDXL modes that's the SDXL pair; for Flux modes it's T5+CLIP-L.switch- theDIFFCONDIoutput fromStoryDiffusion_Apply. This is how the node knows which infer mode it's serving.width/height(256–2048, step 16) - the output size. They flow back out aswidth/heightoutputs so your empty latent can match.role_text/scene_text- described above.pos_text/neg_text- appended to every scene. The default negative is the standard anatomy blocklist.add_style- ten one-click style presets (Realistic, Japanese_Anime, Pixar_Disney_Character, Comic_book, Line_art, Isometric_Rooms...). It appends a style template to the positive and a matching negative.mask_threshold(0–1, default 0.5) andguidance_list- only formsdiffusion: they define the layout boxes (in normalized coordinates) that place each character in the frame.image- the reference image(s) for img2img. One per character. Batch them in.control_image- optional clothing/composition guides for the StoryMaker, UNO and DreamO paths.
Outputs
positive and negative look like CONDITIONING but they aren't vanilla ComfyUI conditioning - positive is the pack's {"role": …, "nc": …, "daul": …} dict, and they only work when fed to StoryDiffusion_KSampler. That's by design, and it's a trap if you try to splice a stock KSampler in here: it'll choke. The output that really matters is condition (DIFFINFO) - it carries role indices, per-role embeddings and dual-scene positions to the sampler. Wire condition into StoryDiffusion_KSampler's condition input.
How it works
It parses both prompt boxes into per-scene prompts, tags each with its character, and encodes them through ComfyUI's CLIP - or, for the img2img/PhotoMaker paths, through the PhotoMaker/IP-Adapter encoders with face embeddings pulled from insightface. Each character's first scene seeds an identity, and every later scene for that character references it. That reference-embedding bookkeeping is why the condition dict is so big.
The gotchas, from people who've actually run it
The most reported failure is "list index out of range" the moment you add a second character. In nearly every case it's the img2img input: you wrote two roles in role_text but only fed one image, so the node can't assign a reference to role two. One reference image per role, in the same order, and it stops.
Beyond that, the mode-specific guards are explicit: story img2img needs a PhotoMaker v1/v2 bin selected in StoryDiffusion_Apply; story_maker only runs img2img; msdiffusion needs at least one dual-role scene line; flux_pulid is img2img-only. If you hit one of these, the error text usually tells you which input to add. Install is just the pack install - git clone https://github.com/smthemex/ComfyUI_StoryDiffusion into custom_nodes plus its requirements, and pip install insightface if you're using the face-ID modes.
Inputs (15)
| Name | Type | Default | Description |
|---|---|---|---|
| clip | CLIP | — | |
| switch | DIFFCONDI | — | |
| width | INT | 768256–2048 | — |
| height | INT | 768256–2048 | — |
| role_text | STRING | [Taylor] a woman img, wearing a white T-shirt, blue loose hair. [Lecun] a man img,wearing a suit,black hair. | — |
| scene_text | STRING | [Taylor] wake up in the bed ; [Taylor] have breakfast by the window; [Lecun] driving a car; [Lecun] is working. | — |
| pos_text | STRING | ,best | — |
| neg_text | STRING | bad anatomy, bad hands, missing fingers, extra fingers,three hands, three legs, bad arms, missing legs, missing arms, poorly drawn face, bad face, fused face, cloned face, three crus, fused feet, fused thigh, extra crus, ugly fingers, horn,amputation, disconnected limbs | — |
| lora_trigger_words | STRING | best quality | — |
| add_style | COMBO | 10 options: No_style, Realistic, Japanese_Anime, Digital_Oil_Painting, Pixar_Disney_Character, Photographic, +4 | |
| mask_threshold | FLOAT | 0.50–1 | — |
| extra_param | STRING | — | |
| guidance_list | STRING | 0., 0.25, 0.4, 0.75;0.6, 0.25, 1., 0.75 | — |
| imageopt | IMAGE | — | |
| control_imageopt | IMAGE | — |
Outputs (5)
| Name | Type | Description |
|---|---|---|
| positive | CONDITIONING | — |
| negative | CONDITIONING | — |
| condition | DIFFINFO | — |
| width | INT | — |
| height | INT | — |