ComfyUI Node

Depth Fog

Atmospheric fog for your AI footage — real depth map, or fake sky haze

By criskb·Created 7 months ago·Updated 5 months ago· 0
Depth Fog
  • video
  • depth_map
  • video
  • output_path
  • summary
fog_color#AFC6D8
near_start0.20
far_end1.00
fog_strength0.65
fallback_fps24.0
output_formatauto
filename_prefixMKR_depth_fog
subfolder
overwritefalse
filename_label

Depth fog is how you sell distance in a shot: the far stuff fades into haze, the near stuff stays crisp. MKRDepthFog applies exactly that to video frames, using a depth map you feed it or - and this is the honest catch - a synthetic vertical gradient when you don't. It's the kind of finishing pass that makes generated footage feel like it was graded rather than rendered flat.

Part of MKRShift_Nodes by criskb. Install via ComfyUI Manager (search "MKRShift_Nodes") or git clone https://github.com/criskb/MKRShift_Nodes into custom_nodes/, restart. Rendering the output video needs ffmpeg on the system.

How it works

For each frame, the node builds a depth estimate (0 = near, 1 = far), normalizes it between near_start and far_end, scales by fog_strength, and mixes the frame toward fog_color. The depth can come from two places:

  • A depth_map IMAGE you connect - a proper per-frame depth map (say, from a depth-estimation model). This gives real atmospheric perspective: hills in the background haze, the foreground stays sharp.
  • No depth map? It falls back to a synthetic "farther toward top" gradient. Which is a polite way of saying it cheats: that's a sky-haze look, not real depth.

That fallback is the one thing to internalize. If your "fog" is only ever the top of the frame, you're getting the gradient, not the depth - and that's fine when you want atmosphere for a skyline, but don't expect it to push your subject into the background.

The inputs

  • fog_color (default #AFC6D8 - a pale steel blue) - the haze tint. Warm sunsets: shift it peach.
  • near_start / far_end (default 0.2 / 1.0) - where the fog ramp begins and ends in depth space.
  • fog_strength (default 0.65) - overall intensity. Lower for a subtle air, higher for full pea-soup.
  • fallback_fps - used if the clip's frame rate can't be read.

Plus the usual output_format (gif/webp/mp4/mov/webm), filename_prefix, subfolder, overwrite, and optional filename_label. Outputs: video (MKR_VIDEO), output_path, and a summary that helpfully reports whether used_depth_map was true or false - so it tells you when you're in the cheat mode.

The honest verdict

For the price of wiring a depth-map pass upstream, this is genuinely useful atmosphere. Without one, it's a vertical haze gradient that's still nicer than nothing but shouldn't be sold as depth. Either way, it's deterministic and fast, and the summary string is honest about what you got.

CategoryMKRShift Nodes/Media/Video/FX

Inputs (12)

NameTypeDefaultDescription
video*
fog_colorSTRING#AFC6D8
near_startFLOAT0.200–1
far_endFLOAT1.000–1
fog_strengthFLOAT0.650–1
fallback_fpsFLOAT24.01–240
output_formatCOMBOauto6 options: auto, gif, webp, mp4, mov, webm
filename_prefixSTRINGMKR_depth_fog
subfolderSTRING
overwriteBOOLEANfalse
depth_mapoptIMAGE
filename_labeloptSTRING

Outputs (3)

NameTypeDescription
videoMKR_VIDEO
output_pathSTRING
summarySTRING