Nodes/ComfyUI-NetflixVoid/VOID Build Grey Mask
ComfyUI Node

VOID Build Grey Mask

The SAM3 node that decides what falls, what stays, and what disappears

By jaskirat05·Created 5 months ago·Updated 5 months ago· 0
VOID Build Grey Mask
  • sam3_model_config
  • images
  • black_mask_video
  • grey_mask_video
  • grey_mask_mask
  • grey_debug
affected_objects_json
grid_rows8
grid_cols8
confidence_threshold0.20
proximity_dilation50
max_detections3

This is the node that does the real segmentation work in the VOID pipeline, and it's the reason the pack ships its own SAM3 loader. The black mask from stage one says what you're removing. The VLM analysis says what else is affected - the guitar that falls, the shadow that vanishes, the ball that was being kicked. This node takes that list of nouns and physically finds each one in your video, then paints it as a grey mask that the quadmask stage will fold in.

It's the difference between VOID and a dumb per-frame inpaint: without this stage, removing a person leaves their shadow burned into the ground and a floating guitar that the model has to hallucinate away. With it, those regions are explicitly masked and regenerated with the rest of the scene.

How it works

The core loop is SAM3 text-prompted segmentation - you hand SAM3 a noun ("guitar", "shadow") and it returns masks, zero-shot, no training. For each object in affected_objects_json it picks a path based on what the VLM reported:

  • Plain objects (category physical, not moving): prompt SAM3 with the noun on the first frame, sort masks by score, keep the top max_detections (default 3), then filter to only masks near the primary object using proximity_dilation (default 50px of dilation around the black mask - keeps the guitar the person is holding while ignoring the identical guitar in the background). The surviving mask is gridified - snapped to whole grid cells, per the workflow's "over-mask is better than under-mask" philosophy - and applied to every frame.
  • Moving objects (will_move: true with a trajectory_path): no per-frame SAM3 needed. The node interpolates the object's grid-coordinate trajectory across frames, draws an object_size_grids-sized box at each position, and the box follows the object down as it falls.
  • Visual artifacts (shadows, reflections, with grid_localizations): the VLM's per-frame grid cells get expanded and carried forward/backward across frames so the shadow is masked for its whole lifetime.

Output grey-mask convention: affected regions = 127/255 (grey), everything else = 1.0 (white). Black from the primary mask is not here - that's still stage one's job.

The inputs that matter

  • sam3_model_config - straight from VOID Load SAM3 Model.
  • images and black_mask_video - the video and the stage-one mask, same frame counts.
  • affected_objects_json - the affected_objects_json output of VOID Parse VLM Analysis. This is why grid_rows/grid_cols must come from VOID Prepare VLM Analysis - trajectory and localization coordinates are interpreted against that exact grid.
  • confidence_threshold (default 0.2) - SAM3 detection confidence floor. Lower = more permissive.
  • proximity_dilation (default 50) - how far from the primary object a detection must be to count. The main false-positive dial.
  • max_detections (default 3) - masks kept per noun.

Outputs: grey_mask_video (IMAGE) and grey_mask_mask (MASK) feed VOID Combine Quadmask; grey_debug (IMAGE) is a red/green overlay showing what it actually masked - look at it before trusting the run.

Install & gotchas

Same as the rest of the pack (Manager → search "ComfyUI-NetflixVoid", or clone into custom_nodes). The heavy lift: first run downloads SAM3 and then pays the lazy model-build cost inside this node - expect a real pause. Frame-count mismatches between images and black_mask_video throw loudly. And if affected_objects_json isn't valid JSON, it refuses rather than guessing - re-run the parse node, don't hand-edit.

CategoryVOID

Inputs (9)

NameTypeDefaultDescription
sam3_model_configSAM3_MODEL_CONFIG
imagesIMAGE
black_mask_videoIMAGE
affected_objects_jsonSTRING
grid_rowsINT81–128
grid_colsINT81–128
confidence_thresholdFLOAT0.200–1
proximity_dilationINT501–512
max_detectionsINT31–50

Outputs (3)

NameTypeDescription
grey_mask_videoIMAGE
grey_mask_maskMASK
grey_debugIMAGE