Black Threshold Filter
Anything near-black becomes pure black
- image
- image
Black Threshold Filter (AIXPOLY_BlackThreshold) does exactly one thing: any pixel whose red, green, and blue channels are all below a threshold gets set to pure black. Everything else is left alone. That's the whole node, and for a narrow set of jobs it's exactly the tool you want.
The pack frames it honestly: it's for cleaning up artifacts in near-black areas after upscaling. If you've ever upscaled a dark texture or a shadow region and zoomed in, you've seen the mess it refers to - the upscaler doesn't know the dark area is supposed to be flat black, so it invents noise and color speckle where the source had nothing. A hard floor fixes that: anything that's "close enough to black" becomes truly black, and the garbage disappears.
Where it fits
It belongs in the resolution stage of this pack's PBR workflow, usually after an upscale pass and before the map goes into a material. For a roughness map, a metalness map, or any map where shadow regions should be dead-flat, this is the cheap way to enforce that. It's also handy as a final tidy-up on albedo maps where near-black should be black.
Just understand the tradeoff. This is a hard binary operation - pixels are either zeroed or untouched, no gradient, no feathering. That's why it suits maps (height, roughness, masks) far better than photographs. Point it at a real photo and you'll carve ugly flat plateaus out of genuine shadow detail. Use it as a pre-pass on texture data, not as a general filter.
Inputs and outputs
image- the map you're cleaning up.threshold(default 0.05, range 0–0.5) - the cutoff. A pixel must have all three channels below this to be zeroed, so 0.05 nukes near-black pixels while leaving any color cast intact. Bump it toward 0.1–0.15 for noisier upscales; keep it low if you're worried about eating real detail.
Output is image, same size, same everything except the pixels that crossed the line.
Install
It ships in the ComfyUI-PBRFusion4 pack, so the install is shared with its siblings. In ComfyUI Manager, search "ComfyUI-PBRFusion4" and install, or:
cd ComfyUI/custom_nodes
git clone https://github.com/Night1099/COMFYUI-PBRFusion4
Restart ComfyUI. No model download - it's a pure tensor operation, instant even on 4K maps.
Gotchas
- It's binary by design. If your output develops hard edges where shadows meet detail, your threshold is too aggressive. Back it off - there's no intermediate setting.
- Threshold is per-channel, not luminance. A dark red pixel (high red, low green/blue) will not be zeroed, because not all channels are under the threshold. If you want luminance-based blacking, this isn't the node.
- The usual pack-level caveat applies: the whole pack disappears if
opencv-python-headlessisn't installed (it's imported at pack load time), so install the pack's requirements before assuming the node is broken.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | — | |
| threshold | FLOAT | 0.050–0.5 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| image | IMAGE | — |