Nodes/ComfyUI Inspire Pack/LeReS Depth Map Preprocessor Provider (SEGS)
ComfyUI Node Runs on cloud

LeReS Depth Map Preprocessor Provider (SEGS)

Depth-guided detail passes

By ltdrdata·Created 3 years ago·Updated 9 months ago· 805
LeReS Depth Map Preprocessor Provider (SEGS)
    • SEGS_PREPROCESSOR
    rm_nearest0.0
    rm_background0.0
    boostfalse

    LeReS is a depth estimator - it looks at a flat image and guesses how far away each pixel is, producing a grayscale depth map where near is bright and far is dark. This node wraps that estimator so a depth ControlNet can guide an Impact Pack detail pass. If you're refining a cropped region and you want the redraw to respect the original's 3D arrangement - foreground stays foreground, the shape of a face keeps its volume - depth is the conditioning you want, and this is how you get it into the SEGS flow.

    LeReS is one of the older monocular depth models. The current darlings are Depth Anything v2/v3 and Marigold, which are sharper. But LeReS is bundled, it's fine, and for a small cropped region during a detail pass the difference rarely shows. It also has a couple of cleanup knobs the newer ones don't expose, which is the reason to reach for it specifically.

    How the SEGS provider pattern works

    Same deferred-preprocessing trick as the rest of Inspire's SEGS/ControlNet nodes. Impact Pack's detailing loop detects regions, crops them, resamples each at full resolution, and pastes back. Apply ControlNet (SEGS) lets that resample be structure-guided - but the crops don't exist when you build the graph, so you can't preprocess them up front. Instead this node hands over a SEGS_PREPROCESSOR: a recipe that says "estimate LeReS depth on each crop, then condition on it." The depth map gets computed per-region at detail time. The actual LeReS implementation lives in Fannovel16's ControlNet Auxiliary Preprocessors; Inspire is the adapter.

    The inputs and outputs that matter

    Three controls, all about cleaning up the raw depth estimate:

    • rm_nearest (default 0) - trims the closest depth values. Bumps up if a bit of foreground junk is being read as "very near" and dominating the map.
    • rm_background (default 0) - trims the farthest values, i.e. flattens or removes the background so the depth signal focuses on your subject.
    • boost (optional, default off) - LeReS "boost" mode runs a higher-detail depth estimation. More accurate, noticeably slower. On a small crop the accuracy gain is usually not worth the time, so leave it off unless you specifically see the depth guidance falling apart.

    Honestly, for most detail passes you can leave all three at their defaults. They're there for the cases where the raw depth map has garbage at the near or far extremes.

    The single output is SEGS_PREPROCESSOR, wired into the preprocessor input of Impact Pack's Apply ControlNet (SEGS).

    How to install it

    ComfyUI Manager: search ComfyUI Inspire Pack, install, restart. Or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/ltdrdata/ComfyUI-Inspire-Pack
    

    then restart. Dr.Lt.Data's pack - same author as ComfyUI-Manager and the Impact Pack.

    Common issues & troubleshooting

    No output, no effect. By design. This node only feeds an Apply ControlNet (SEGS) node in an Impact Pack graph; alone it does nothing and shows no preview.

    Red node after install. Missing dependencies. You need comfyui_controlnet_aux (which supplies the LeReS model) and the Impact Pack. The first time LeReS runs it also downloads its model weights, so give it a minute and a working connection.

    Still need a depth ControlNet checkpoint. The provider handles preprocessing only. You load an actual depth ControlNet (matched to your base model) and feed it to Apply ControlNet (SEGS) separately.

    Depth map looks flat or noisy. That's rm_nearest / rm_background territory - trim whichever extreme is misbehaving. If the whole estimate is just weak, try boost on, and accept the slowdown. And if you want the best depth quality available, a modern Depth Anything preprocessor upstream will beat LeReS; this node is the convenient bundled option, not the sharpest one.

    CategoryInspirePack/SEGS/ControlNet

    Inputs (3)

    NameTypeDefaultDescription
    rm_nearestFLOAT0.00–100
    rm_backgroundFLOAT0.00–100
    boostoptBOOLEANfalse

    Outputs (1)

    NameTypeDescription
    SEGS_PREPROCESSORSEGS_PREPROCESSOR