Eden_DepthSlice_MaskVideo
Sweep a depth window through a scene
- depth_map
- depth_slice_masks
- gamma_corrected_depth_map
Depth maps are great for separating things, but they're even better when you let a "depth window" travel through them. Eden_DepthSlice_MaskVideo is the animated cousin of DepthSlicer: instead of cutting the depth map into static layers with k-means clustering, it sweeps a sliding slice from near to far (or far to near) across n_frames, producing a mask video where each frame reveals a different depth band. One depth map in, a whole animation out.
It's the mechanism behind the "focus travels through the scene" look - objects pop into mask existence one depth layer at a time - and it composes beautifully with frame-by-frame inpainting to make content reveal or regenerate in depth order.
How it works
The node takes a depth map (bright = close, as the KB's depth essay frames it) and normalizes it to 0β1, then optionally applies gamma_correction - raising the value brightens mid-tones and shifts where the slice bands land, which is your main way to bias the sweep toward near or far detail. It then marches a window of width slice_width from min_depth to max_depth across the depth range, one step per frame, and each frame becomes a binary mask showing which pixels fall inside the current window.
Two animation controls round it out:
- reverse - flips the direction of the sweep.
- bounce - runs the sweep forward, then back, so the animation loops instead of snapping. The code halves the frame budget for the forward pass and concatenates the reverse, giving you a smooth ping-pong.
Inputs and outputs
- depth_map - IMAGE, the depth map to sweep.
- slice_width (default 0.1) - how wide the depth band is. Narrower = more slices visible across the animation.
- min_depth / max_depth (0 / 1) - the depth range to sweep. Tighten these to restrict the sweep to part of the scene.
- gamma_correction (default 1) - depth curve shaping, as above.
- n_frames (default 100) - length of the mask animation.
- reverse, bounce - direction and looping.
Outputs: depth_slice_masks (the MASK video - one frame per depth step) and gamma_corrected_depth_map (the depth map after gamma, as a MASK), which is handy if you want to see exactly what the gamma did.
How to use it
The pattern is the same "mask β inpaint" recipe as DepthSlicer but animated: convert each mask frame to a latent mask, run a masked inpaint pass per frame, and you get a video where content regenerates in strict depth order - the background changes first, then the mid-ground, then the foreground, like a camera focus pulling through the scene. The KB's inpainting essay backs the approach: masked inpainting guarantees the unmasked region stays pixel-identical, which is exactly what keeps this frame-stable. Feed it a good depth map (MiDaS-class preprocessors) and start with a wide slice_width (0.2β0.3) to avoid a too-thin, noisy reveal.
Installing
One of 70+ nodes in edenartlab/eden_comfy_pipelines (Eden.art nodesuite):
cd ComfyUI/custom_nodes
git clone https://github.com/edenartlab/eden_comfy_pipelines.git
cd eden_comfy_pipelines
pip install -r requirements.txt
Or ComfyUI Manager β search "Eden". Pure torch math - no extra model downloads beyond your depth map source.
Gotchas
The output is MASK, not IMAGE - so unlike DepthSlicer you're already in mask territory, which is convenient but means you can't just preview it as an image without conversion. Watch n_frames Γ resolution: a 100-frame mask batch at high res eats VRAM like any stacked animation. And remember the depth map gets normalized internally, so extremely flat or extremely contrasty maps will behave - but you'll get better sweeps from a clean, well-lit depth source. If the sweep looks wrong, gamma_correction is your first lever, not slice_width.
Inputs (8)
| Name | Type | Default | Description |
|---|---|---|---|
| depth_map | IMAGE | β | |
| slice_width | FLOAT | 0.100.01β0.99 | β |
| min_depth | FLOAT | 0.000β1 | β |
| max_depth | FLOAT | 1.000β1 | β |
| gamma_correction | FLOAT | 1.00.1β10 | β |
| n_frames | INT | 1001β9223372036854776000 | β |
| reverse | BOOLEAN | false | β |
| bounce | BOOLEAN | false | β |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| depth_slice_masks | MASK | β |
| gamma_corrected_depth_map | MASK | β |