Nodes/ComfyUI-SAM3DBody/SAM 3D Body Process Multiple
ComfyUI Node

SAM 3D Body Process Multiple

3D mesh recovery for more than one person in the frame

By PozzettiAndrea·Created 9 months ago·Updated 2 months ago· 321
SAM 3D Body Process Multiple
  • model
  • image
  • masks
  • depth_map
  • intrinsics
  • depth_confidence
  • multi_mesh_data
  • preview
inference_typefull
adjust_position_from_depthfalse

The regular SAM3DBodyProcess node finds one person in a photo and meshes them. SAM3DBodyProcessMultiple is what you use the moment there's more than one person in the shot - a group photo, two people talking, a whole lineup. It's built specifically for the multi-person case Pozzetti added after the initial release, and it comes with a known, author-acknowledged accuracy quirk worth knowing before you rely on it.

How it works

Unlike the single-person node, this one doesn't detect people for you - you have to hand it a mask per person yourself, typically produced upstream by a segmenter like Impact Pack's SAM integration or SAM2. Feed it the image plus those masks, and it runs SAM 3D Body inference once per masked region, giving you back a bundle of meshes rather than one.

There's a real, documented limitation here. Per the pack's own README, people who are smaller in the photo because they're standing further from the camera tend to get reconstructed at normal size, just placed farther back in 3D space - not actually scaled down the way they should be. The author added an optional depth-based correction for exactly this, and says himself it "still needs some work." Don't expect group-photo depth to come out perfect on the first try.

The inputs and outputs that matter

  • model (SAM3D_MODEL) - from LoadSAM3DBodyModel, required.
  • image (IMAGE) - the group photo.
  • masks (MASK) - required, and plural. This is the biggest difference from the single-person node: you need per-person segmentation done before this node runs. There's no built-in detector here.
  • inference_type (default full, optional) - same mode selector as the other Process nodes.
  • depth_map (IMAGE, optional), intrinsics (INTRINSICS, optional), depth_confidence (IMAGE, optional) - feed these in if you have real depth information for the scene (from a depth model in your graph) rather than letting the node guess relative distance from the 2D layout alone.
  • adjust_position_from_depth (default false, BOOLEAN) - flip this on, along with the depth inputs above, to engage the size/position correction for the smaller-people-placed-farther bug. It's off by default, so if your group photo output looks like everyone's the same size just at different distances, this is the setting to try.

Two outputs: multi_mesh_data (SAM3D_MULTI_OUTPUT) - note the different type from the single-person node's SAM3D_OUTPUT, it doesn't slot into SAM3DBodyExportFBX or SAM3DBodyExportMesh directly, you want SAM3DBodyExportMultipleFBX for that. preview (IMAGE) gives you a quick look at what was reconstructed for the whole group before you export anything.

How to install it

Via ComfyUI Manager, search SAM3DBody, install, restart - or manually:

cd ComfyUI/custom_nodes
git clone https://github.com/PozzettiAndrea/ComfyUI-SAM3DBody.git
cd ComfyUI-SAM3DBody
pip install -r requirements.txt --upgrade
python install.py

You'll want a segmentation node pack installed too (Impact Pack's SAM nodes, or similar) since this node expects masks handed to it rather than detecting people itself - the pack doesn't bundle a multi-person segmenter, that's on you to bring.

Common issues & troubleshooting

Everyone comes out the same size, just at different depths. This is the known bug described above. Try adjust_position_from_depth with real depth_map/depth_confidence/intrinsics inputs rather than relying on the defaults - and go in expecting a partial fix, not a perfect one.

Masks don't line up with the people you expect. This node processes exactly what your masks give it - a sloppy or overlapping mask from your segmenter produces a sloppy or overlapping mesh downstream. Check masks visually before running this node, it'll save you a re-run.

Runs noticeably slower than the single-person node. That's expected - it's running full inference once per person rather than once total. A photo with five people costs roughly five times the compute of one.

Nothing textured, same as everywhere else in this pack. Multi-person output is still shape and pose only, no clothing or skin detail, per person.

CategorySAM3DBody/processing

Inputs (8)

NameTypeDefaultDescription
modelSAM3D_MODELLoaded SAM 3D Body model from Load node
imageIMAGEInput image containing multiple people
masksMASKBatched masks - one per person (N, H, W)
inference_typeoptCOMBOfullfull: body+hand decoders, body: body decoder only
depth_mapoptIMAGEDepth map from Depth Anything V3 (Raw mode) for scale correction - helps fix children/small people appearing too large
intrinsicsoptINTRINSICSCamera intrinsics from Depth Anything V3 - [3,3] or [4,4] matrix with fx, fy, cx, cy. Provides accurate focal length instead of default 5000
depth_confidenceoptIMAGEConfidence map from Depth Anything V3 - used to weight depth samples and filter unreliable measurements
adjust_position_from_depthoptBOOLEANfalseAdjust Z-position of each person based on depth map (requires depth_map)

Outputs (2)

NameTypeDescription
multi_mesh_dataSAM3D_MULTI_OUTPUT
previewIMAGE