Nodes/DOGMA Nodes/DOGMA v35 Fast Category Mask Pair
ComfyUI Node

DOGMA v35 Fast Category Mask Pair

The mask padding is chosen by what the object is

By axior·Created 4 months ago·Updated 3 days ago· 1
DOGMA v35 Fast Category Mask Pair
  • mask
  • generation_mask
  • stitch_mask
  • info
category
threshold0.50

Same two-mask trick as the v34 sibling - a wide mask for sampling, a tight feathered one for compositing - except you don't set the numbers. You pass a category string and the node looks up how much room that kind of thing needs.

That sounds like a gimmick. It isn't, quite. A face wants the model's attention inside a small radius; widening a face mask by 30px drags hair and background into the rebuild. A car, especially a small one at distance, wants a lot of road around it or the model has no idea which way it's pointing. "12 pixels" is not a universal answer, and a table of per-category values is one honest way of admitting that.

The table

The node lowercases your category string and looks it up directly:

| category | generation grow | stitch grow | feather | |---|---|---|---| | vehicles | 24 | 3 | 8 | | people | 28 | 3 | 8 | | street furniture | 20 | 2 | 7 | | architectural details | 16 | 2 | 6 | | faces | 12 | 1 | 5 | | hands | 12 | 1 | 5 | | animals | 22 | 3 | 8 | | furniture | 18 | 2 | 7 | | machinery | 20 | 2 | 7 | | clothing | 14 | 2 | 6 | | products | 14 | 2 | 6 | | anything else | 20 | 2 | 7 |

Then it thresholds the input mask at threshold, builds the generation mask as the core dilated by its grow value (plus a small 2px outward softening), and builds the stitch mask as the core dilated by stitch grow and smoothed outward by feather - with max(core, blur) so the core stays exactly opaque. Same CUDA-first thresholding as v34, same "opaque core" guarantee in the info line.

Inputs and outputs

  • mask (MASK)
  • category (STRING) - normally wired from a planner (DOGMAFixedCategoriesV37 or a semantic plan node) rather than typed.
  • threshold (FLOAT, default 0.5, 0.01–0.99)

Outputs generation_mask (MASK) for the sampler, stitch_mask (MASK) for the stitch, and info (STRING) which prints the category and the three values it used. That info line is your answer to "did it recognise my category," and you should read it the first time.

Install

cd ComfyUI/custom_nodes
git clone https://github.com/axior/ComfyUI-DOGMA-Nodes

Manager → DOGMA Nodes, or comfy node install comfyui-dogma-nodes. No dependency step and no downloads: the repo's requirements.txt is a single comment line, pyproject.toml declares no dependencies, and the node needs nothing beyond torch. MIT licensed.

Where people get burned

The lookup is an exact string match, not the fuzzy matcher. This is the trap. Elsewhere in the pack, category strings go through a keyword matcher that happily maps carpet to vehicles. Here, the node does table.get(category_lowercased) and nothing else - so a category the rest of the pipeline recognises can still miss this table completely and quietly fall back to 20/2/7. street_objects, which is what DOGMAFixedCategoriesV37 emits, is not street furniture and gets the generic row. person is not people. You get a plausible mask either way, which is why nobody notices; you just don't get the tuning you installed it for. Read the info line and match the strings by hand.

Wrong mask downstream, again. generation_mask goes to the sampler's mask input. stitch_mask goes to the stitch node. Swapping them is the single most common wiring error in this family, and it produces content invented outside your object, because you composited a region wider than the one you asked the model to rebuild.

Resolution scaling. Every value in that table is a pixel count tuned at one working size. Halve your tile resolution and those 24px of car padding become 12px of real-world context. Rescale the category approach by scaling threshold isn't possible here - it's fixed per category - so at very different resolutions you want the v34 sibling where you can set the numbers directly.

Where it fits. This is the "detect → mask → rebuild" middle of the loop that FaceDetailer made standard: something finds the object, the mask defines ownership, a local pass rebuilds it, a stitch pastes it back. This node owns the awkward second step, which is the one people usually under-think.

CategoryDOGMA/Semantic Detailer

Inputs (3)

NameTypeDefaultDescription
maskMASK
categorySTRING
thresholdFLOAT0.500.01–0.99

Outputs (3)

NameTypeDescription
generation_maskMASK
stitch_maskMASK
infoSTRING