๐ผ> Fog
Atmospheric haze that respects depth, if you feed it a depth map
- image
- depth_map
- image
A flat haze overlay would just tint the whole image evenly, which reads as a color filter, not fog. Real atmospheric fog is denser the farther away something is - distant objects wash out more than the foreground. This node's actual feature is exactly that: it uses a depth map you provide to vary fog density across the scene, so you can keep the foreground relatively clear while the background fades into haze, which is what sells the effect as atmosphere rather than a wash.
Good candidates: landscape/environment generations where you already have (or can generate) a depth map from a ControlNet-style depth estimation step, moody scene compositions, or just adding a bit of atmospheric perspective to a flat-looking render.
How it works
depth_map supplies a per-pixel depth value (a MASK, so effectively grayscale - typically brighter meaning nearer or farther depending on how your depth source encodes it). The node blends fog_color into the image at a strength that ranges between fog_front (fog density at the nearest depth) and fog_back (density at the farthest depth), scaled overall by fog_intensity.
The inputs and outputs that matter
image- the source scene.depth_map(MASK, required) - this is what makes the effect depth-aware rather than a flat overlay; there's no way to skip it and get a uniform fog from this node, since it's a required input, not optional.fog_intensity(default0.25, 0โ1) - overall strength of the effect.fog_front(default0, 0โ1) andfog_back(default1, 0โ1) - how much fog sits at the near and far ends of the depth range respectively. Defaults give you the intuitive setup (clear foreground, fully fogged background); swap them if your depth map's polarity is inverted relative to what the node expects, or if you deliberately want fog concentrated up close instead.fog_color(default16777215, pure white as a packed RGB integer) - the fog's tint. White reads as classic daytime haze; adjust for colored atmospheric effects (a cooler blue-gray for overcast, warmer tones for something like smoke or dust).
One output: image, the fogged result.
How to install it
Via ComfyUI Manager: search "yanc" or "YANC - Yet Another Node Collection," install, restart. Manually:
cd ComfyUI/custom_nodes
git clone https://github.com/ALatentPlace/ComfyUI_yanc
then restart. No extra dependencies to install for this node itself - though producing a good depth_map typically means a separate depth-estimation node/model earlier in your graph if you're not sourcing depth from elsewhere.
Common issues & troubleshooting
Fog looks backwards - foreground is hazy, background is clear. This almost always means the depth map's polarity doesn't match what the node expects (near vs. far mapped to the opposite brightness than assumed), or fog_front/fog_back are set opposite to your intent. Try swapping fog_front and fog_back's values before assuming the depth map itself is wrong.
No fog effect at all despite settings. Check fog_intensity isn't at 0, and make sure depth_map is actually connected - it's required, but a blank/flat mask (all one value) will also produce a uniform, barely-there result since there's no depth variation for the node to work with.
Fog looks like a flat color wash rather than atmospheric depth. That's the symptom of a depth map with little real variation in it - if your depth source is low-quality or the scene doesn't have much depth range to begin with, the node has nothing meaningful to key off, and you'll get something close to a uniform tint no matter how you tune fog_front/fog_back.
Inputs (6)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | โ | |
| depth_map | MASK | โ | |
| fog_intensity | FLOAT | 0.250โ1 | โ |
| fog_front | FLOAT | 0.000โ1 | โ |
| fog_back | FLOAT | 1.000โ1 | โ |
| fog_color | INT | 167772150โ16777215 | โ |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| image | IMAGE | โ |