Nodes/ComfyUI-Rennart/🌗 Rennart Exposure Fusion
ComfyUI Node

🌗 Rennart Exposure Fusion

Lift the shadows, save the sky — without the HDR look

By Rennart2025·Created 3 months ago·Updated 11 days ago· 4
🌗 Rennart Exposure Fusion
  • image
  • image
  • weights_preview
  • info
◄shadows_ev1.0►
◄shadows_range0.35►
◄highlights_ev0.5►
◄highlights_range0.85►
◄highlight_detail0.50►
◄mid_tone0.50►
◄sigma0.20►
◄contrast_weight0.0►
◄saturation_weight0.0►
◄halo_control0.50►
◄protect_lights0.50►
◄luminance_onlytrue►
◄protect_tonestrue►
◄strength1.00►

The problem it solves

Most "too dark" fixes in ComfyUI are one-knob: a gamma curve, or spacepxl's Exposure Adjust - rightly so, since the deterministic post-processing layer exists so you don't burn a diffusion pass on work a lookup table does perfectly (post-processing.md). The trouble is a gamma node lifts everything, highlights included, so it does nothing for the backlit photo: subject in mud, sky already at 255. You need up in one zone, down in another, midtones untouched.

That's exposure fusion - an old computational-photography trick (Mertens et al., 2007): your phone's bracket-three-shots-and-merge mode. This node fakes that bracket from one image. No model, no mask, just deterministic numpy.

Where it earns a slot: backlit portraits, dead sunset foregrounds, restoration work, AI output with clipped blacks - photorealism.md already treats pulling contrast down as standard de-AI cleanup. Where it can't help: pixels that were never recorded. It redistributes tone; it doesn't invent it.

How it works

Four stages, each one a knob.

It builds virtual exposures with an honest EV shift in linear light - brighter copies up to shadows_ev, darker ones down to highlights_ev. The copy count is the ceiling of that value, so shadows_ev = 1.4 gives two copies at +0.7 and +1.4 EV. Each copy gets a participation mask measured on the original luminance: one soft ramp confines the brighter copies to shadows, another confines the darker copies to highlights - so a +2 EV copy can't touch your sky.

Each copy then gets a per-pixel weight - a Gaussian centred on mid_tone, sigma wide - times its mask, refined with a guided filter against the source's edges so the field stops at a light/dark border instead of leaking across it; pyramid depth is clipped so it can't reach further either. That's halo_control, and it's why the result doesn't wear the classic tone-mapped halo. The copies merge through Laplacian pyramids, and only the L channel of LAB is replaced - a/b come straight from your source, so the color never shifts.

Two refinements matter. highlight_detail gates darkening on local variation, so only highlights with real texture get pulled down - flat sky stays white. protect_lights wide-blurs the near-white pixels into a glow field and damps shadow lifting around them, so streetlamps don't swell into bright discs.

The inputs that matter

Fourteen knobs is a lot. You need four.

  • shadows_ev (1.0, up to 4.0) and highlights_ev (0.5, up to 3.0) - how far each end may move. Zero leaves that end alone.
  • shadows_range (0.35) and highlights_range (0.85) - luminance thresholds for shadow and highlight, soft-edged. Raise shadows_range and the lift reaches into the midtones.
  • halo_control (0.5) - 0 is textbook fusion, 1 is maximum suppression at the cost of slightly duller bright sources.
  • luminance_only and protect_tones (both on) - leave them on: colour stays honest, tones stay ordered, and luminance-only is roughly three times faster.

Leave mid_tone, sigma, contrast_weight and saturation_weight at defaults; contrast_weight's own tooltip warns it amplifies noise in shadows.

Three outputs: image; weights_preview, where grey is the untouched source, yellow/orange marks brighter copies and blue marks darker ones; and info, a text block of the settings it ran with, for Show Text / Show Any.

A sane start for a backlit photo: shadows_ev 1.0–1.5, highlights_ev 0.5, halo_control 0.5, strength 1.0 - then sneak strength to 0.7 if it reads over-processed.

Installing it

ComfyUI Manager, search ComfyUI-Rennart, install, restart. Or by hand:

cd ComfyUI/custom_nodes
git clone https://github.com/Rennart2025/ComfyUI-Rennart

Restart and look for 🌗 Rennart Exposure Fusion under Rennart/Image. The pack's requirements.txt is literally torch and numpy - nothing else installs, no models to download.

Where people get burned

It runs on the CPU, per frame. The node pulls the batch onto the CPU and loops in numpy - no VRAM needed, but four 4K frames will make you wait. Run it on your final pick.

Shadows come up, noise comes with them. +2 EV reveals what was hiding in the dark. If they go crunchy, drop shadows_ev before you reach for a denoiser.

Grey whites mean highlights_ev is too high or highlight_detail is at 0 - at zero, every highlight gets darkened, flat ones included.

Both EVs at zero is a silent no-op - the info output says the image passed through unchanged. Check that first if the node "does nothing".

Alpha gets dropped. It slices the first three channels, so RGBA input loses transparency without complaint. Keep alpha on its own branch, or use the pack's Rennart RGBA to RGB node.

This earns its fourteen knobs when both ends of the histogram are broken at once - and weights_preview is the part I like most, because it shows you the mask instead of asking you to trust it.

CategoryRennart/Image

Inputs (15)

NameTypeDefaultDescription
imageIMAGE—
shadows_evFLOAT1.00–4Насколько можно высветлить тени (EV). Строятся копии +1, +2 … до этого значения. 0 — тени не трогать.
shadows_rangeFLOAT0.350.05–0.8Что считать тенями: яркость исходника ниже этого значения (0..1, мягкая граница ±0.1).
highlights_evFLOAT0.50–3Насколько можно затемнить пересветы (EV). 0 — света не трогать.
highlights_rangeFLOAT0.850.5–1Что считать светами: яркость исходника выше этого значения (мягкий переход начинается на 0.1 ниже).
highlight_detailFLOAT0.500–2Затемнять света только там, где есть детали. 0 — затемнять все света; больше — плоские белые зоны (небо, стена) не трогаются.
mid_toneFLOAT0.500.2–0.8К какому тону стремиться (0.5 — середина).
sigmaFLOAT0.200.05–0.6Строгость выбора: меньше — сильнее тянет к mid_tone, больше — мягче.
contrast_weightFLOAT0.00–2Предпочитать версии с бо́льшим локальным контрастом. Может усиливать шум в тенях.
saturation_weightFLOAT0.00–2Предпочитать более насыщенные версии.
halo_controlFLOAT0.500–1Подавление ореолов: веса следуют за краями (guided filter) и меньше протекают на соседние зоны. 0 — классическое слияние; 1 — максимум (яркие источники могут слегка посереть).
protect_lightsFLOAT0.500–1Не вытягивать тени рядом с источниками света (фонари, фары), чтобы свечение вокруг них не раздувалось в диск.
luminance_onlyBOOLEANtrueМенять только яркость L (LAB), цвет оставить от исходника. Также ускоряет работу в 3 раза.
protect_tonesBOOLEANtrueТени не делать темнее исходника, света — не ярче.
strengthFLOAT1.000–1Сила эффекта: смешивание яркости с исходником.

Outputs (3)

NameTypeDescription
imageIMAGE—
weights_previewIMAGE—
infoSTRING—