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

MiDaS Depth Map Preprocessor Provider (SEGS)

Depth ControlNet, but per detected region

By ltdrdata·Created 3 years ago·Updated 9 months ago· 805
MiDaS Depth Map Preprocessor Provider (SEGS)
    • SEGS_PREPROCESSOR
    a6.28
    bg_threshold0.10

    Here's the thing that trips everyone up first: this node has no image input. You'd expect a depth preprocessor to take a picture and spit out a depth map, and it doesn't. That's because it isn't a preprocessor you run - it's a provider. It hands a preprocessor recipe to Impact Pack, which then runs it later, on each face or object it detected, during a detail pass.

    That's the whole idea. In a normal ControlNet workflow you preprocess the full image once. But when you're doing detailing - cropping out each detected region and resampling it at full resolution - you want the depth conditioning computed on each crop, not the whole frame. The SEGS preprocessor providers exist so Apply ControlNet (SEGS) can do exactly that. This one wires depth into that loop using MiDaS.

    Why depth, and why MiDaS

    Depth ControlNet conditions generation on the spatial arrangement of a scene - what's near, what's far - so a regenerated region keeps the same 3D structure instead of drifting. MiDaS is the old reliable here. It's Intel's monocular depth estimator, the one that shipped with SD 2.0's depth2img and was the default depth preprocessor through 2022-2023. It produces relative depth (which things are closer, not distances in meters), and for ControlNet that's exactly what you want: the community's canonical "Zoe Depth vs MiDaS, spoiler: use MiDaS" test landed on MiDaS specifically because its sharper edges guide ControlNet better than a metrically-accurate-but-soft map. Newer estimators (Depth Anything, etc.) are more accurate, but MiDaS is fast and the ecosystem is built around it.

    How it works

    The node builds a SEGS_PREPROCESSOR object and outputs it. You feed that into the preprocessor slot of Impact Pack's Apply ControlNet (SEGS) node, together with a depth ControlNet model and your SEGS (the detected regions). During the detailer pass, Impact Pack crops each segment, runs MiDaS on the crop to get a depth map, and applies your depth ControlNet to that region's regeneration. You never see the depth map as an image - it lives inside the loop.

    The inputs that matter

    There are only two, and honestly you can leave both alone:

    • a (default ~6.28, which is 2π) - MiDaS's angle/curvature coefficient. It nudges how the depth field is shaped. Defaults are fine; only touch it if your depth output looks flat or over-contrasted.
    • bg_threshold (default 0.1) - the background cutoff. Raise it to push more of the scene into "far away," lower it to keep faint background detail.

    Output is a single SEGS_PREPROCESSOR. It goes one place: Apply ControlNet (SEGS).

    Installing it

    It ships in the Inspire Pack by Dr.Lt.Data - the same author behind ComfyUI Manager and the Impact Pack, so you're in trustworthy hands. Easiest path is ComfyUI Manager: search ComfyUI Inspire Pack, install, restart. Manually:

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

    then restart ComfyUI. Two dependencies actually matter for this node: you need ComfyUI's ControlNet Auxiliary Preprocessors (that's where the real MiDaS code lives - Inspire just wraps it), and you need the Impact Pack installed, since Apply ControlNet (SEGS) and the whole SEGS pipeline come from there. Install all three or this node has nothing to plug into.

    Common issues

    "It errors the moment I run it." Almost always a missing comfyui_controlnet_aux. The provider is a thin wrapper; if the underlying preprocessor package isn't there, it can't build the recipe. Install it via Manager and restart.

    Nodes won't load after install. By far the most common Inspire Pack complaint on r/comfyui, and the fix is boring: read your terminal log. It usually names a version mismatch - update Inspire Pack and Impact Pack together, since Inspire leans on Impact and the two want to be on compatible versions.

    You're looking for a depth image and can't find the output. You won't get one from this node - it doesn't produce an image, it produces a config. If you want a standalone depth map to preview, use the plain MiDaS preprocessor from controlnet_aux instead. This node is only for the SEGS/detailer path.

    CategoryInspirePack/SEGS/ControlNet

    Inputs (2)

    NameTypeDefaultDescription
    aFLOAT6.280–15.70796326794897
    bg_thresholdFLOAT0.100–1

    Outputs (1)

    NameTypeDescription
    SEGS_PREPROCESSORSEGS_PREPROCESSOR