Nodes/RyanOnTheInside/Flex Mask Depth Chamber βš‘πŸ…‘πŸ…žπŸ…£πŸ…˜
ComfyUI Node

Flex Mask Depth Chamber βš‘πŸ…‘πŸ…žπŸ…£πŸ…˜

Carve a mask out of a depth slice, and let audio or motion move it

By ryanontheinsideΒ·Created 2 years agoΒ·Updated 5 months agoΒ· 852
Flex Mask Depth Chamber βš‘πŸ…‘πŸ…žπŸ…£πŸ…˜
  • masks
  • depth_map
  • opt_feature
  • MASK
β—„strength1.00β–Ί
β—„feature_threshold0.00β–Ί
β—„feature_paramβ–Ύβ–Ί
β—„feature_modeβ–Ύβ–Ί
β—„invertfalseβ–Ί
β—„subtract_original0.00β–Ί
β—„grow_with_blur0.0β–Ί
β—„mask_strength1.00β–Ί
β—„z_front1.00β–Ί
β—„z_back0.00β–Ί

Regular depth-based masking gives you a static slice: "everything between this depth and that depth is white, the rest is black." Depth Chamber does that too, but it's built on RyanOnTheInside's "Flex" system, which means the slice itself - how near, how far - can move over time, driven by audio, motion, or any other reactive signal you plug in. The name is apt: you're carving out a chamber in Z-space, and the chamber's walls can breathe.

This is one of several "Flex" nodes in the pack, all built around the same idea the author calls "Everything-Reactivity": nearly any parameter can be modulated by a FEATURE input pulled from audio, MIDI, motion, color, or time, instead of being locked to a fixed number. Other node authors in the ComfyUI ecosystem have built packs specifically compatible with this Feature system (the Depthflow node pack is one), so it's not a niche one-off - it's become a bit of a shared standard for reactive ComfyUI workflows.

How it works

Feed it a depth map (any standard depth-estimation output - MiDaS, Depth Anything, whatever you're already using upstream for ControlNet) and a mask, set z_front/z_back to define the depth window you want to keep, and it outputs a mask limited to that window. The feature_param field is where the reactivity comes in: leave it at None for a static chamber, or set it to z_front, z_back, or both to let an incoming FEATURE signal push those thresholds around as the video plays.

The inputs and outputs that matter

  • masks (MASK) and depth_map (IMAGE), both required - your starting mask and the depth map to slice against.
  • z_front / z_back (default 1 / 0, range 0–1) - the near and far bounds of the depth window you're keeping.
  • feature_param (z_front / z_back / both / None) - which threshold(s) a FEATURE input is allowed to modulate.
  • feature_mode (squeeze / expand / move_forward / move_back) - how the modulation changes the chamber: squeeze/expand shrink or grow the window, move_forward/move_back shift the whole window along Z.
  • opt_feature (optional, type FEATURE) - the reactive signal itself. Per its tooltip: "Connect any feature node here to control the effect. Features can come from audio, motion, color, or other sources."
  • strength, feature_threshold, invert, subtract_original, grow_with_blur, mask_strength - the standard Flex mask post-processing set: overall intensity, the minimum feature value before anything happens, mask inversion, subtracting the original mask back out, blur-based mask growth, and a final strength multiplier.
  • Output - a single MASK.

How to install it

Via ComfyUI Manager: search "RyanOnTheInside," install, restart. Manually:

cd ComfyUI/custom_nodes
git clone https://github.com/ryanontheinside/ComfyUI_RyanOnTheInside.git
cd ComfyUI_RyanOnTheInside
pip install -r requirements.txt

then restart. No model downloads here - this node is pure geometry/math on a mask and a depth map you already have.

Common issues & troubleshooting

The mask is empty or covers everything. z_front/z_back convention matters - get them backwards (front behind back) and you'll get an empty or inverted-looking result. Nudge one at a time from the defaults and watch what changes before assuming the node is broken.

Nothing reacts even though you wired in opt_feature. Check feature_param isn't still on None - that's the field that actually turns reactivity on, and it's easy to wire the feature input and forget to flip this.

Depth map quality matters more than any setting here. This node only works with the depth map you give it. A noisy or low-resolution depth estimate produces a noisy, unstable chamber regardless of how carefully you tune thresholds - fix that upstream first.

CategoryRyanOnTheInside/FlexFeatures/Targets/Masks

Inputs (13)

NameTypeDefaultDescription
strengthFLOAT1.000–1Overall strength of the feature modulation (0.0 to 1.0)
feature_thresholdFLOAT0.000–1Threshold for feature activation (0.0 to 1.0)
feature_paramCOMBOChoose which parameter to modulate: - z_front: Dynamically adjust front threshold - z_back: Dynamically adjust back threshold - None: No parameter modulation
feature_modeCOMBOMode of feature modulation ('squeeze', 'expand', 'move_forward', 'move_back')
masksMASKInput mask or sequence of masks to be processed (MASK type)
invertBOOLEANfalseWhen enabled, inverts the mask output (black becomes white and vice versa)
subtract_originalFLOAT0.000–1Amount of the original mask to subtract from the result (0.0 to 1.0)
grow_with_blurFLOAT0.00–10Amount of Gaussian blur to apply for mask growth (0.0 to 10.0)
mask_strengthFLOAT1.000–1Overall strength of the mask effect (0.0 to 1.0)
depth_mapIMAGEInput depth map (IMAGE type)
z_frontFLOAT1.000–1Front depth threshold (0.0 to 1.0)
z_backFLOAT0.000–1Back depth threshold (0.0 to 1.0)
opt_featureoptFEATUREOptional feature input for modulation Connect any feature node here to control the effect. Features can come from audio, motion, color, or other sources.

Outputs (1)

NameTypeDescription
MASKMASKβ€”