Depth Injection β‘π ‘π π £π
Fake a bulge or sphere into a depth map, mask-bound
- depth_maps
- mask
- opt_feature
- IMAGE
Depth maps out of Depth Anything or MiDaS give you the geometry of what's actually in the shot - they don't let you add geometry that isn't there. Depth Injection is a small, sharp tool for exactly that gap: pick a region with a mask, and it stamps a spherical gradient into that region's depth values, faking a bulge, a dent, or a rounded volume that never existed in the original scene. It's the kind of trick that got this pack a real following on r/StableDiffusion, where the author's own "Depth Chamber" workflow - using this DepthModifiers family to do Houdini-style Z-depth manipulation without touching a 3D app - got picked up and remixed by other users who were surprised they could pull off product-shot-style depth effects entirely inside ComfyUI.
How it works
You feed it depth_maps (the existing depth image, output from whatever depth estimator you're using upstream) and a mask marking where the injection should apply. Inside that masked region, the node writes a spherical gradient running from depth_min to depth_max, with gradient_steepness controlling how sharply that gradient falls off - low values give a gentle, gradual bulge, high values give something closer to a hard, defined sphere edge. strength blends the injected gradient against the original depth values in that region rather than replacing them outright, and feature_threshold sets a floor below which the effect doesn't apply at all.
Like the rest of the pack's Flex-adjacent nodes, this one accepts an optional FEATURE through opt_feature. feature_param picks what gets modulated - gradient_steepness, depth_min, depth_max, strength, or None - and feature_mode decides whether that modulation is relative (nudges around your set value) or absolute (scales from zero). Left disconnected, the effect is completely static: one fixed bulge, same on every frame.
Inputs and outputs
depth_maps(required,IMAGE) - your existing depth map, upstream from a depth estimator. It's typed as a plain image because that's what a depth map is under the hood: a grayscale image where brightness encodes distance.mask(required,MASK) - defines exactly where the spherical gradient gets injected.depth_min/depth_max- the value range the injected gradient spans, 0 to 1.gradient_steepness- how sharp the fake bulge's edge reads.- Output - a single modified
IMAGE, the same depth map with your region overwritten.
Installing it
Install through ComfyUI Manager (search RyanOnTheInside) or manually:
cd ComfyUI/custom_nodes
git clone https://github.com/ryanontheinside/ComfyUI_RyanOnTheInside
Then pip install -r requirements.txt and restart ComfyUI. This node doesn't need a depth-estimation model of its own - you supply the depth map - but you'll want a real depth estimator (Depth Anything v2 is the current community default) upstream to actually generate the base map this modifies.
Common issues
The most common miss is skipping the mask and expecting a targeted effect - without a well-drawn mask, you either affect nothing meaningful or apply the gradient somewhere you didn't intend, since the injection is strictly bound to whatever region the mask defines. If the "bulge" reads flat or barely visible, check strength before assuming depth_min/depth_max are wrong - a low strength blends the injected gradient so gently against the original it can look like nothing happened.
Downstream, remember this node only edits the depth map itself - whatever you do with that modified map (feed it to a ControlNet, a parallax/warp node, a 3D export) is a separate step, and how convincing the final effect looks depends heavily on how well the injected gradient's scale matches the rest of the scene's actual depth range.
Inputs (10)
| Name | Type | Default | Description |
|---|---|---|---|
| strength | FLOAT | 1.000β1 | Overall strength of the effect (0.0 to 1.0) |
| feature_threshold | FLOAT | 0.000β1 | Minimum feature value to apply the effect (0.0 to 1.0) |
| feature_param | COMBO | Parameter to be modulated by the feature | |
| feature_mode | COMBO | relative | How the feature modulates the parameter ('relative' or 'absolute') |
| depth_maps | IMAGE | Input depth maps to be processed | |
| mask | MASK | Input mask defining areas for depth modification | |
| gradient_steepness | FLOAT | 2.00.1β10 | Controls the steepness of the spherical gradient (0.1 to 10.0) |
| depth_min | FLOAT | 0.000β1 | Minimum depth value for the modified areas (0.0 to 1.0) |
| depth_max | FLOAT | 1.000β1 | Maximum depth value for the modified areas (0.0 to 1.0) |
| opt_featureopt | FEATURE | Optional feature input for parameter modulation |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| IMAGE | IMAGE | β |