ComfyUI Node
BD Parts Builder
Build a PARTS_BUNDLE from per-prompt SAM3 masks (preferred) or Sapiens2 labels. Each part gets its own RGBA crop + bbox + tag + per-part depth (when depth_image wired). Primary output is `parts` for the BD_Parts* pipeline. Auxiliary outputs (image_batch, label_list, bbox_list) feed BD_BulkSave / ImageUpscaleWithModel for batch-only workflows. Selection presets only match Sapiens2's 29-class taxonomy. For SAM3 source use 'all' or 'specific'.
BD Parts Builder
- image
- sapiens2_labels
- masks
- depth_image
- combined_mask
- image_batch
- label_list
- bbox_list
- parts
◄selection_modeall►
◄padding_pixels5►
◄output_sizenative►
◄square_padpad_to_square►
◄backgroundalpha►
◄min_pixels64►
◄mask_labels►
◄selection_list►
◄output_size_custom1024►
◄background_hex#888888►
Category🧠BrainDead/Segmentation
Inputs (15)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | — | |
| selection_mode | COMBO | all | all = every class except Background. clothing/bodyparts = curated subsets (Sapiens2 taxonomy). specific = whitelist from selection_list. |
| padding_pixels | INT | 50–512 | Pixels of padding around each part's bbox (in source resolution). |
| output_size | COMBO | native | native = keep crop's natural size (per-part may differ — batched by padding to common max). 512/1024/2048 = scale longest side, preserve aspect. |
| square_pad | COMBO | pad_to_square | pad_to_square: center each crop in NxN canvas (uniform aspect, ideal for upscaler batching and T3D). none: keep aspect, pad batch to the rectangular common-bbox of all crops. |
| background | COMBO | alpha | alpha = RGBA, mask baked to alpha channel (best for T3D). white/black/hex = composite onto solid background (best for 2D pipeline). |
| min_pixels | INT | 641–10000000 | Drop parts whose mask area is fewer than this many pixels. |
| sapiens2_labelsopt | SAPIENS2_LABELS | Preferred input from Sapiens2Segmentation. Carries class_ids tensor + part name taxonomy. When wired, `masks` and `mask_labels` are ignored. | |
| masksopt | MASK | Generic MASK batch (B,H,W) — one mask per class. Used when sapiens2_labels is not wired (e.g. SAM3 multi-prompt output). | |
| mask_labelsopt | STRING | Parallel labels for `masks` (newline or comma separated). Auto-named part_00, part_01, … if shorter than the batch. | |
| depth_imageopt | IMAGE | Optional depth IMAGE (e.g. from BD_Lotus2Predict.raw_linear). When wired, each part's depth_median is computed from the median depth value within its mask region (used by Composite for back-to-front sort), AND the cropped depth map for that part is stored in the parts dict so Export can save it. Use the raw_linear output (0=near, 1=far) for proper sorting. | |
| combined_maskopt | MASK | Optional silhouette mask. When wired, every per-class/per-prompt mask is intersected with this before bbox + crop. Sources: • BD_SAM3MultiPrompt.combined_mask — drops pixels removed by negatives / vote / color filter. The authoritative final layer. • Sapiens2SegmentationAdvanced.foreground_mask — confines per-class to body. WARNING: do NOT wire an inverted mask here. If SAM3's invert_combined=True is set upstream, you'll get the BACKGROUND silhouette — every real part will be zeroed and you'll see only a single full-image leftover. | |
| selection_listopt | STRING | When selection_mode=specific: comma or newline separated label names to include (e.g. 'Left_Shoe,Right_Shoe,Upper_Clothing'). | |
| output_size_customopt | INT | 102464–8192 | Used when output_size=custom. |
| background_hexopt | STRING | #888888 | Hex color when background=hex. Accepts #RGB or #RRGGBB. |
Outputs (4)
| Name | Type | Description |
|---|---|---|
| image_batch | IMAGE | — |
| label_list | STRING | — |
| bbox_list | STRING | — |
| parts | PARTS_BUNDLE | — |