Nodes/BrainDead Nodes/BD Even Light
ComfyUI Node

BD Even Light

Take the key light off a cel-shading pass without flattening the facets

By BizaNator·Created 9 months ago·Updated 22 days ago· 15
BD Even Light
  • image
  • mask
  • image
  • report
◄keep_light0.50►
◄facet_gain0.90►
◄sigma60►

What it's for

Ask a model for "cell shaded, dynamic shadowing" and Qwen Image 2.1 does something very literal: it lights the head with one hard key, so you get a bright side and a shadow side. That's fine for a hero render and wrong for an asset, because the engine is going to light this thing itself and it doesn't want your baked-in sun.

Asking the model for even lighting instead doesn't work either - the author's note is blunt about why: prompts that ask for even light flatten the facets too, because the facets are contrast and the model has no idea which contrast you meant. So this node splits the two jobs after the fact. The lighting gradient is a heavy blur of luminance; the facets are whatever the blur didn't explain. Scale one down, scale the other up.

It's the cheapest kind of fix - a deterministic pixel operation with no seed and no second diffusion pass, which is the exact class of tool our KB's post-processing doc argues people should reach for first.

How it works

Luminance is computed with standard Rec.601 weights. "Light" is a mask-normalised Gaussian blur of that luminance (sigma pixels at 1024, scaled to your image width), which means the blur is only computed over the head and won't drag the background's brightness inward. "Facets" is luminance minus light. The output luminance is:

mean + keep_light × (light − mean) + facet_gain × facets

and the colour is carried over by ratio, so hue and saturation stay where they were and only the light changes. Outside the mask, the image isn't touched at all.

The defaults aren't guesses. The code documents a calibration run against a real FaceMaker albedo: keep_light 0.5 / facet_gain 0.9 landed at light std 18 vs the target 23, facet std 42 vs 39, left-right difference 25 vs 21 levels. Close enough that you can start there and stop fiddling.

The inputs that matter

  • image - the shaded head (the FaceMaker Qwen Cell Shaded pass is the intended input).
  • keep_light (default 0.5, 0–1) - how much of the lighting gradient survives. 0 is perfectly even, 1 is a no-op.
  • facet_gain (default 0.9, 0–3) - facet contrast multiplier. 1 is unchanged; above 1 pushes the low-poly planes harder than the model drew them.
  • sigma (default 60, 5–400) - the blur size, in pixels at 1024. Keep it comfortably larger than a facet, or the blur starts eating the very thing you're protecting.

mask is optional. Wire it (the head mask or the Plates matte) and only the head is touched. Skip it and the node assumes the head is everything that differs from the corner colour by more than 12 levels - fine on a flat white or black backdrop, unreliable on anything busy.

Outputs are image and report, a JSON blob with the measured light/facet statistics. Read the report, not just the picture; the numbers tell you whether you actually moved the light or just crushed something.

Installing it

ComfyUI Manager → search "BrainDead" → install → restart. Or:

cd ComfyUI/custom_nodes
git clone https://github.com/BizaNator/ComfyUI-BrainDead
cd ComfyUI-BrainDead && pip install -r requirements.txt

That install drags in the pack's 3D dependencies (MoGe, utils3d, natten) even though this node needs none of them - it's numpy, OpenCV and PIL under the hood. No model downloads, no VRAM.

Traps and troubleshooting

It is not a relighter. It can only scale down the light that's already in the pixels; it can't invent a light from the other side. If what you actually want is a subject relit to match a new scene, that's a diffusion job - IC-Light is the tool the community still points at for it (see concepts.md), and it degrades stylised input toward photorealism, which is exactly what you don't want here.

"skipped: empty head mask" in the report means the mask covered fewer than a hundred pixels - usually an inverted or empty mask upstream. Nothing was changed.

Very dark or very saturated heads can shift. Colour is carried by a clipped ratio, so if you push facet_gain up hard on near-black hair the ratio has little room to work with. Pull facet_gain back toward 1 and check the report.

Sigma far smaller than a facet = blurring your own detail away. If the result looks soft rather than evenly lit, sigma is too low and the "facets" term is now picking up noise. Go bigger.

Category🧠BrainDead/Segmentation

Inputs (5)

NameTypeDefaultDescription
imageIMAGE—
keep_lightFLOAT0.500–1Share of the lighting gradient kept. 0 = perfectly even, 1 = unchanged.
facet_gainFLOAT0.900–3Facet contrast multiplier. 1 = unchanged.
sigmaFLOAT605–400Light blur in px at 1024 (scaled with the image). Larger than a facet.
maskoptMASKHead mask (1 = head). None: pixels that differ from the corner colour.

Outputs (2)

NameTypeDescription
imageIMAGE—
reportSTRING—