diff --git a/CONTEXT.md b/CONTEXT.md index 4c6f510..bbeef39 100644 --- a/CONTEXT.md +++ b/CONTEXT.md @@ -17,16 +17,20 @@ - **Strength:** Full strength (1.0) works perfectly - **Limitations:** Rectangular regions only, no complex shapes -#### Mask-Based Conditioning (Flux/Chroma/SD3) -- **Models:** Flux (all variants), Chroma (Chroma1-Radiance, etc.), SD3/SD3.5 +#### Mask-Based Conditioning (Flux, Chroma, SD3, etc.) +- **Models:** Flux (all variants), Chroma (Chroma1-Radiance, etc.), SD3/SD3.5, and other mask-based models - **Technology:** Binary masks created from drawn boxes - **Critical Discovery:** Flux requires **0.7-0.85 mask strength** (NOT 1.0!) - Full strength (1.0) creates harsh, over-defined regions - Research shows 180-220 out of 255 (0.7-0.85 normalized) optimal - Implementation uses 0.8 as sweet spot + - **Other Models:** Works well with mask-based models in general, user testing needed - **Feathering:** 40-60px (5-8 latent pixels) gentle feathering improves blending -- **Region Limit:** Flux works best with 3-4 regions maximum -- **CFG Guidance:** Increase to 5-7 (vs typical 3-5) for better regional control + - Tied to `soften_masks` toggle - user can disable for sharp edges +- **Region Limit (Flux):** Flux works best with 3-4 regions maximum (confirmed) +- **Region Limit (Chroma):** Likely 3-4 regions too since Chroma is Flux-based (UNTESTED - needs user confirmation) +- **Region Limit (SD3/SD3.5):** No known limit +- **CFG Guidance (Flux):** Increase to 5-7 (vs typical 3-5) for better regional control #### CLIP Encoding (Inline Prompts) - **Method:** `clip.tokenize(prompt)` → `clip.encode_from_tokens(tokens, return_pooled=True)` @@ -59,7 +63,13 @@ #### Qwen-Image Compatibility - **Status:** Experimental/Unknown - **Type:** Generation model (not edit variant) -- **Theory:** Should work with standard CONDITIONING if it follows ComfyUI conventions +- **Theory:** Should work with mask-based conditioning (RegionalPrompterFlux) if it follows ComfyUI conventions +- **Guidance:** "Try it and see what breaks" - no specific settings known +- **Recommendation:** + - Start with mask-based node (RegionalPrompterFlux) + - Keep soften_masks ON + - Try standard settings and adjust based on results + - Report findings to help others! - **Blocker:** No test workflows or confirmed compatibility reports - **Future:** Needs actual testing with Qwen-Image checkpoints @@ -151,8 +161,9 @@ except Exception as e: 2. **✅ FIXED: Soften Masks Clarity** - **Was:** Parameter named `flux_optimize` (confusing since node works for Chroma/SD3 too) - **Now:** Renamed to `soften_masks` with explicit tooltip guidance - - **Tooltip:** "✅ RECOMMENDED: Softer masks (0.8 strength + gentle edge blend) work better than harsh full-strength (1.0) masks. Confirmed for Flux. Try it first for Chroma/SD3, disable if you prefer sharper region edges." + - **Tooltip:** "✅ RECOMMENDED: Softer masks (0.8 strength + gentle edge blend) work better than harsh full-strength (1.0) masks. Confirmed better for Flux, works well with other mask-based models. Disable if you prefer sharper region edges." - **Node Description:** Dedicated "💡 IMPORTANT" section explaining when to keep ON vs turn OFF + - **Model References:** Changed from "Try it first for Chroma/SD3" to "Works well with other models - try it first!" (more general) - **Impact:** Users understand it's a softness toggle (not Flux-specific magic), know when to enable/disable 3. **✅ FIXED: Feathering Concerns** @@ -173,9 +184,11 @@ except Exception as e: 5. **✅ FIXED: Workflow Setup Confusion** - **Question:** Does it need a latent input? - **Answer:** NO! Only needs CLIP input + width/height parameters (just numbers) + - **Pro Tip:** Width/height inputs accept connections - users can drag from Empty Latent Image outputs! - **Clarification:** Node outputs CONDITIONING (connects to KSampler positive input) - **README:** Added detailed workflow diagram showing exact connections - - **Impact:** Users understand the node flow correctly + - **Node Description:** Added tip about connecting from Empty Latent Image + - **Impact:** Users understand the node flow correctly AND can auto-sync dimensions 6. **Dynamic Latent Sizing:** - **Question:** Does it work with any input size? @@ -203,10 +216,13 @@ except Exception as e: 5. ❌ **Don't use "Flux"** as shorthand for mask-based conditioning **Examples:** -- ✅ Good: "Mask-based node for Flux, Chroma, SD3" +- ✅ Good: "Mask-based node for Flux, Chroma, SD3, etc." - ❌ Bad: "Flux node" (implies Flux-only) -- ✅ Good: "Soften Masks (confirmed better for Flux, try for others)" -- ❌ Bad: "Flux Optimize" (confusing for Chroma/SD3 users) +- ✅ Good: "Soften Masks (confirmed better for Flux, works well with other models)" +- ❌ Bad: "Flux Optimize" (confusing for other model users) +- ✅ Good: "3-4 region limit for Flux" (specific model reference) +- ⚠️ Uncertain: "Chroma likely has 3-4 region limit too (untested)" (honest about uncertainty) +- ✅ Good: "Flux and similar models" (acknowledges Flux-based architecture) ### Audit Checklist - [x] Node names clarified (not Flux-exclusive) diff --git a/README.md b/README.md index 2ce9e34..f312c26 100644 --- a/README.md +++ b/README.md @@ -126,15 +126,15 @@ These require external CLIP Text Encode nodes but offer more flexibility. ## 🎯 Model Compatibility -| Model Type | Node to Use | Status | -|------------|-------------|--------| -| **Stable Diffusion 1.5** | 🎨 Regional Prompter (SD/SDXL) | ✅ Fully Supported | -| **Stable Diffusion 2.x** | 🎨 Regional Prompter (SD/SDXL) | ✅ Fully Supported | -| **SDXL** | 🎨 Regional Prompter (SD/SDXL) | ✅ Fully Supported | -| **Flux** (all variants) | 🎨 Regional Prompter (Flux/Chroma) | ✅ Fully Supported & Optimized | -| **Chroma** (Radiance, etc.) | 🎨 Regional Prompter (Flux/Chroma) | ✅ Fully Supported | -| **SD3 / SD3.5** | 🎨 Regional Prompter (Flux/Chroma) | ✅ Fully Supported | -| **Qwen-Image** | 🎨 Regional Prompter (Flux/Chroma) | 🟡 Experimental (untested) | +| Model Type | Node to Use | Status | Notes | +|------------|-------------|--------|-------| +| **Stable Diffusion 1.5** | 🎨 Regional Prompter (SD/SDXL) | ✅ Fully Supported | No region limit | +| **Stable Diffusion 2.x** | 🎨 Regional Prompter (SD/SDXL) | ✅ Fully Supported | No region limit | +| **SDXL** | 🎨 Regional Prompter (SD/SDXL) | ✅ Fully Supported | No region limit | +| **Flux** (all variants) | 🎨 Regional Prompter (Flux/Chroma, etc.) | ✅ Fully Supported & Optimized | 3-4 regions max recommended | +| **Chroma** (Radiance, etc.) | 🎨 Regional Prompter (Flux/Chroma, etc.) | ✅ Architecture Supported | Likely 3-4 region limit (untested) | +| **SD3 / SD3.5** | 🎨 Regional Prompter (Flux/Chroma, etc.) | ✅ Architecture Supported | No known region limit | +| **Qwen-Image** | 🎨 Regional Prompter (Flux/Chroma, etc.) | 🟡 Experimental | Try it and report results! | --- @@ -176,11 +176,16 @@ When you add a Regional Prompter node, you'll see: ### Tips for Best Results #### For Flux Users: -- ✅ **Enable "Flux Optimize"** (it's on by default) - This uses special mask strength (0.8) that works better than full strength +- ✅ **Keep "Soften Masks" ON** (it's on by default) - Uses 0.8 strength that works better than full strength - ✅ **Use 3-4 regions maximum** - More regions = quality degradation - ✅ **Increase CFG to 5-7** - Flux needs higher guidance for regional control - ✅ **Draw larger boxes** - Bigger regions = better control +#### For Flux-Based Models (Chroma, etc.): +- ✅ **Keep "Soften Masks" ON** - Works well with Flux-based architectures +- ⚠️ **Likely 3-4 region limit** - Chroma is based on Flux, may have same limitations (untested) +- ✅ **Start with Flux settings** - Increase CFG to 5-7, try and adjust + #### For SDXL Users: - ✅ **Align to 64px grid** - Matches latent space boundaries - ✅ **No region limit** - Use as many as you need @@ -247,9 +252,12 @@ Load Checkpoint → CLIP - ✅ **KEEP ON (default):** Softer region edges, better blending (0.8 strength + gentle feather) - ❌ **Turn OFF only if:** You want sharp, harsh region boundaries (1.0 strength, no feather) - **Why it's better:** Research shows softer masks (0.8) produce better results than full-strength (1.0) for Flux -- **For Chroma/SD3:** Try it ON first (default), disable only if you prefer sharper edges +- **For other models:** Works well with mask-based models - try it ON first, disable only if you prefer sharper edges - **What feathering does:** Gentle edge blending (5-8 pixels) to avoid harsh boundaries - you can disable by turning this toggle OFF +**💡 Pro Tip - Auto Width/Height:** +You can **connect** the width/height outputs from your **Empty Latent Image** node directly to this node's width/height inputs! No need to type them manually - they'll stay in sync automatically. + --- ### Advanced Nodes (For Power Users) @@ -492,9 +500,10 @@ Load Checkpoint **Key Points:** - ✅ Width/height in the Regional Prompter should match your Empty Latent Image size +- 💡 **PRO TIP:** Connect width/height outputs from Empty Latent Image → Regional Prompter for auto-sync! - ✅ No latent input needed on the Regional Prompter - it just needs the numbers! - ✅ The node outputs CONDITIONING, not an image - connect to KSampler's positive input -- ✅ Keep "Soften Masks" ON for better results (especially Flux) +- ✅ Keep "Soften Masks" ON for better results (especially Flux and Flux-based models) ### Advanced Mode Workflow (For Power Users) When you need shared CLIP encodings or more control: diff --git a/RegionalPrompting.py b/RegionalPrompting.py index 12735ad..909edbb 100644 --- a/RegionalPrompting.py +++ b/RegionalPrompting.py @@ -197,7 +197,7 @@ class RegionalPrompterFlux: }), "soften_masks": ("BOOLEAN", { "default": True, - "tooltip": "✅ RECOMMENDED: Softer masks (0.8 strength + gentle edge blend) work better than harsh full-strength (1.0) masks. Confirmed for Flux. Try it first for Chroma/SD3, disable if you prefer sharper region edges." + "tooltip": "✅ RECOMMENDED: Softer masks (0.8 strength + gentle edge blend) work better than harsh full-strength (1.0) masks. Confirmed better for Flux, works well with other mask-based models. Disable if you prefer sharper region edges." }), }, "optional": { @@ -209,12 +209,12 @@ class RegionalPrompterFlux: "region3_prompt": ("STRING", { "default": "", "multiline": True, - "tooltip": "Prompt for third region (optional - note: Flux works best with 3-4 regions max)" + "tooltip": "Prompt for third region (optional - note: Flux and similar models work best with 3-4 regions max)" }), "region4_prompt": ("STRING", { "default": "", "multiline": True, - "tooltip": "Prompt for fourth region (optional - note: Flux works best with 3-4 regions max)" + "tooltip": "Prompt for fourth region (optional - note: Flux and similar models work best with 3-4 regions max)" }), }, "hidden": {"extra_pnginfo": "EXTRA_PNGINFO", "unique_id": "UNIQUE_ID"}, @@ -225,7 +225,7 @@ class RegionalPrompterFlux: FUNCTION = "encode_regions_flux" CATEGORY = "Davemane42/Enhanced" DESCRIPTION = """🎨 ALL-IN-ONE Mask-Based Regional Prompting (EASY MODE!) -For: Flux, Chroma, SD3, SD3.5 +For: Flux, Chroma, SD3, and other mask-based models Just type your prompts and draw boxes - that's it! @@ -235,10 +235,11 @@ Just type your prompts and draw boxes - that's it! ✅ Up to 4 regions + background ✅ Visual box drawing interface ✅ Comes with example prompts pre-filled! +✅ Width/height can be connected from Empty Latent Image node! How to use: 1. Connect CLIP from your checkpoint -2. Set your output width/height (e.g., 1024x1024) +2. Set output width/height (or connect from Empty Latent Image!) 3. Review example prompts (or replace with your own) 4. Draw boxes on canvas for each region 5. Leave "Soften Masks" ON (recommended for all models) @@ -248,13 +249,15 @@ How to use: • ✅ KEEP ON (default): Softer region edges, better blending (0.8 strength + gentle feather) • ❌ Turn OFF only if: You want sharp, harsh region boundaries (1.0 strength, no feather) • Confirmed better results with Flux when ON -• Try it first for Chroma/SD3, disable only if you dislike the effect +• Works well with other mask-based models - try it first! Model-Specific Tips: -• FLUX: Use 3-4 regions max, increase CFG to 5-7, draw larger regions -• CHROMA/SD3: No region limit, standard CFG values work fine +• FLUX: Use 3-4 regions max (quality degrades with more), increase CFG to 5-7 +• FLUX-BASED (Chroma, etc.): Likely 3-4 region limit too (untested), try and see! +• SD3/SD3.5: No known region limit, standard CFG values +• QWEN-IMAGE: Experimental - try mask-based conditioning and report results! -Compatible: Flux (all variants), Chroma, SD3, SD3.5""" +Compatible: Flux (all variants), Chroma, SD3, SD3.5, and other mask-based models""" def encode_regions_flux(self, clip, width, height, background_prompt, region1_prompt, soften_masks, extra_pnginfo, unique_id,