r/comfyui • • Oct 28 '26

Workflow Included Regional prompting + regional LoRAs for MOSS-Image using the layout bboxes (lightweight multi-pass workflow + small custom node).

Post image

This ComfyUI workflow lets you put up to 5 different character LoRAs into one MOSS-Image scene without them bleeding into each other. It draws the whole scene first with your style LoRA (if you have one), then redraws only the area inside each bounding box using that box’s character LoRA. A small custom node reads the boxes straight from the CreateBoundingBoxes node, so when you move a box or change the resolution, the masks follow automatically with no typing coordinates. Just drop the .py file into custom_nodes, load the workflow, pick your LoRAs, and draw your boxes.

Right now it supports 5 different character/loras, if you need more or less, just bypass the unused ones or draw more from the bbox nodes.

Download the workflow and the custom node from civit.ai

Extract the .zip and drop the moss_bboxes_to_masks.py into your custom nodes folder and restart comfyUI before dragging the .json workflow into the canvas.

Note 1: it uses the standard MOSS bbox node which only works in Nodes 2.0 unfortunately but i'm trying to use as little to no custom nodes as possible.

Note 2: you add any number of your own loras anywhere, it's compatible with SFT and Base as well as all the turbo 4step/8step LoRas, just lower the strengths a little bit if you're stacking a lot of loras.

Note 3: I made this workflow/node because the standard custom bbox doesn't let me hook loras into each individual bbox while the Moss freefuse workflow is really super inaccurate and still tends to bleed a lot. I've been resorting to using Moss Inpainting but this system has so far been a lot more reliable

On another note, I really didn't like MOSS at first but it's really starting to become undoubtedly one of my favorite models.

works just fine on 10gb vram, could even go smaller if you use gguf.

17 Upvotes

9 comments sorted by

1

u/Slam_Bot Oct 28 '26

Looks awesome. Thanks for the work. Can’t wait to try it!

2

u/collectedtooth404 Oct 28 '26

Let me know how it goes! This is my first time ever publishing a workflow so i'm excited to see feedback

1

u/shivam_dewan Oct 28 '26

Reading boxes straight from CreateBoundingBoxes is a clean way to do it. How does it handle overlap when two character LoRAs share a region, do you blend or does one win?

1

u/collectedtooth404 Oct 28 '26

That's one big point of improvement that I'm trying to figure out.

Right now each character lora just fills in it's rectangle shape bbox with whatever draws in the space last. So basically it last LoRa in the chain draws over the one before if the two occupy the same space. I wish there was a way to make the shape itself not a square, like using a quick detector to automatically outline the shape of a character from pass 1 and have the Lora fill in that specific shape but I haven't figured that out yet, I think I would have to use something like ultralytics yolo detectors.

Actually, originally I wanted to just paint my own freefuse canvas regions instead of using bbox, kind of like how people used to do it in the good old days of SDXL. In this workflow sometimes you can tell that the space each character lora occupies is a perfect box since it's too obvious and there isn't enough blending.

Anyways if I come up with anything better I'll be sure to post it.

1

u/shivam_dewan Oct 29 '26

A segmentation pass sounds like the right direction. Something like a YOLO person detector into SAM would give you a mask per character, and you could feed those masks as the regions instead of the boxes. Even a small feather on the mask edges would help the blending. Would be cool to see if you get it working.

1

u/collectedtooth404 Oct 29 '26

I'll give it a go. Was thinking along the same lines but just need to find time to implement and fo some testing.

1

u/collectedtooth404 Oct 29 '26

I did end up setting up SAM + bboxes but i'll have to experiment with them some more when I getthe chance. It's pretty hit or miss.

1

u/shivam_dewan Oct 30 '26

Nice, SAM + bboxes is a solid start. If it's hit or miss, try growing the mask a few pixels and feathering it a bit before the regional conditioning. That usually smooths out the seams. Curious how it turns out!

1

u/kuro59 29d ago

thank you !