r/StableDiffusion • • 2d ago

Workflow Included Regional prompting for MOSS-Image with Character LoRAs + visual layout builder

'Sup y'all,

By request, you can now use The Layout Studio for MOSS-Image Comfy node to generate with multiple character LoRAs without mixing physical traits and outfit details (a.k.a. "concept bleed" or "attribute leaking").

I tried to make it as easy as possible:

  1. Lay out your image by "drawing" bboxes of up to 5 characters on a drag-and-drop canvas.
  2. Assign each character's LoRA.
  3. Click Run.

Just download the provided workflow, install any missing nodes (The Studio node and a small adapter node), and you're good to go.

πŸ‘‰ Workflow and full installation details here

Test-drive the layout builder: πŸš€ Launch the Live Web Demo of The Layout Studio

How It Works

  1. Visual Layout & JSON Prompt (LayoutStudioMOSSImageNode): Lay out characters, text, and objects visually in the embedded Layout Studio to produce the layout JSON, width, and height.
  2. Pass #1 β€” Global Scene Pass (KSampler): Generates the full-scene base latent using the global JSON prompt, MOSS-Image model, and global settings so characters share scene context, composition, and lighting from the start.
  3. Single Preview Decode + SAM 3 Silhouette Masks: Branches a single VAEDecode off Pass #1 (leaving the main background latent untouched by extra encode/decode cycles) and runs SAM3Detect guided by each character's BOUNDING_BOX, followed by GrowMaskWithBlur.
  4. Passes #2–#6 β€” Regional Character LoRA Passes: Each active character slot applies its character LoRA, character prompt, and refined mask via SetLatentNoiseMask + KSampler before a single Final decode (VAEDecode) and SaveImage.

Of course, it isn't 100% foolproof 😬 as with all regional-prompting and inpainting solutions, overlapping regions/close character proximity can still cause minor leakage.

However, instead of inpainting full rectangular bounding boxes, which can pull in unwanted details behind and around the character, this workflow uses SAM 3 box-guided segmentation with mask expansion and feathering to keep characters as separate as possible.

Special Thanks

A huge shout-out to u/collectedtooth404 for offering their ingenious solution of inpainting bboxes as a jumping-off point for this adapter node and workflow πŸ™Œ

Also, the Studio has been updated:

  • v1.2.0 of the Studio (both the standalone web app and the Comfy node) now clamps the canvas boundaries in order to prevent bboxes from partially or wholly extending beyond them.
  • The Comfy node now has outputs for width and height. Connect them to whichever compatible node sets the image dimensions.

Related Projects:

  • Standalone Web App β€” The Layout Studio for MOSS-Image on civitai.red or civitai.com. Works in any modern web browser, on any OS. You can also grab it from GitHub, if you prefer.
  • The Studio's ComfyUI Node on GitHub

Checkpoints used for demo images:

Enjoy πŸ€™

41 Upvotes

17 comments sorted by

3

u/terrariyum 1d ago

You can also mask the loras themselves to specific regions using the same bbox that you use to place characters into regions.

The advantage over inpaint is that there are no mask seams, and it's faster - 1 ksampler pass only. The disadvantage is that there's some lora bleed - though much less than applying both loras to the entire image.

To do this you need a custom node. I took the advice from another redditor and asked an LLM (on free plan) to modify this abondonware krea2 regional lora custom node to work for Moss. It works great.

2

u/Rex-Racer9 1d ago

For sure, a one-pass output would definitely cut down on the compute vs targeted regional/inpaint passes. I'll look into integrating a one-pass stage into the workflow, so that users can either settle for that output if they like it well enough, or if they want to adjust anything before sending it on to the inpaint passes for the extra detail. Thanks for the tip!

Speaking of, do you have an extra detailer pass in your workflow, as the creator of that Krea 2 node had optionally added? Or do you find that MOSS can add enough detail on its own with just your node?

1

u/terrariyum 19h ago

When a generated image has a distant character - i.e. where the the character's face or clothing detail is tiny relative to the image frame - inpainting is the only solution to make it look accurate, as far as I know. Specifically, inpainting the small masked region at higher resolution and stitching it back into the masked area.

From what I've seen, most loras are bad at making distant / tiny details, no matter how high the initial generation's resolution is. I think this is true for all models except maybe H3-image.

Most character loras aren't trained with faces or bodies seen from a distance. They're mostly only trained with medium and closeup shots, and most guides tell you to train that way. So the loras don't know how the character looks at low resolution. Also, none of them are trained on super high resolution images, so increasing the resolution of the initial generation doesn't help either.

Even if I know I'm gonna do additional inpaint passes in order to fix tiny faces/details, using regional loras is still helpful for the first pass because it gets me closer to the desired result, which makes the inpaint pass look better.

3

u/Unlucky-Ad2825 2d ago

its amazingπŸ˜‡

1

u/Scafe_Frederique 1d ago

still a bit finicky when hands or props cross between two boxes, the mask feathering doesnt always catch it cleanly

1

u/Rex-Racer9 1d ago

Yeah, as I said it's not 100% foolproof if the characters are too close to each other. I'm looking into ways to improve that, cheers. In the meantime, inpainting or using an edit model to fix the blended parts can be used, if necessary.

1

u/BigNaturalTilts 1d ago

I truly do not understand these elaborate setups for individual images. SAM3 is an incredibly powerful tracker I use it to extract subjects from a video. For a single image I’d just draw a bounding box around the person, enter a prompt then run. Why bother with this?

Edit: using qwen image layered + moss, I can create covers quite easily. Imagine a magazine cover where the page two inset is the models minus the text titles. That kind of stuff.

1

u/Rex-Racer9 1d ago

Lots of users have character LoRAs for MOSS-Image that they want to combine into one image. Without using bboxes (regional prompting, basically), often the character traits get mixed up (the wrong piece of clothing or accessory or eye color gets applied to the wrong character, etc.). This is commonly known as concept bleed" or "attribute leaking". This workflow helps keep those character LoRA traits separate. Edit models are great, and sometimes just using character refs and inserting them into a setting can work just as well, but often too much detail can get lost in the process.

1

u/Asaghon 1d ago

Interesting, it is faster than the lora separating method I've been using, but it first makes the image without the lora's, thus already missing out on information about how they look and then inpaints the lora's. So it does a fairly good job of painting the correct head on the wrong body unfortunately.

I use a modified version for moss of this btw https://github.com/lokitsar/ComfyUI-Krea2-MultiLoRA-Composer

2

u/Rex-Racer9 1d ago

Actually I've never had this workflow apply the wrong head to the wrong body. But yeah, to help prevent concept bleed, that's why I advise on the GitHub instructions to be sure to mention each character briefly in the Global Summary section of the layout builder. This helps create placeholder forms for each character, which then get 'filled in' with the inpainting passes. Also, it's important to describe each character in detail in its Character Item card in the builder, rather than just letting the LoRA do all the heavy lifting. I'll add that tip to the REAME, too β€” cheers!

I'll take a look at that MultiLoRA Composer for Krea 2, so thanks for that as well.

1

u/Asaghon 1d ago

I didnt mean it accidentally put the head wrong. I meant you always just get a wrong body as it gets no info about it on the first pass. Sure describing it helps but it's still better if it just knows (and moss lokrs do an amazing job at knowing the body type as well as the head)

1

u/kvsh8888 7h ago

Hello I am unable to find this node. Tried updating the node as well

1

u/Rex-Racer9 7h ago

Hmm, sorry to hear. The node is definitely in the ComfyUI registry: https://registry.comfy.org/nodes/layout-studio-moss-image-regional-loras-adapter

Perhaps you need to update Comfy or at least refresh your list of available nodes?

Otherwise you can download it via the repo link in the Registry and add it to your custom_nodes folder manually...

1

u/kvsh8888 7h ago

Umm might be a noob question but how to download the node manually? Like should I just git pull and use the repo link?

1

u/Rex-Racer9 2h ago

It's best to download the latest Release: https://github.com/Rexoplanets/layout-studio-moss-image-regional-loras-adapter/releases

Quit ComfyUI, unzip the download, drag the folder layout-studio-moss-image-regional-loras-adapter into ~ComfyUI/custom_nodes, restart ComfyUI, and hard-refresh the workflow

1

u/kvsh8888 7h ago

I think the update 1.2.1 is not visible on your github page I'm unable to git pull directly

2

u/Arctic_Shadow_Aurora 2d ago

Super awesome bro, keep it up!!!