Threshold
Converts an image to black and white based on a luminance cutoff with optional soft edge.
Category: Color Menu path: Color > Threshold
Ports
| Port | Type | Direction | Description |
|---|---|---|---|
in | imageRgba16f | input | Input image |
out | imageRgba16f | output | Thresholded result (grayscale) |
Parameters
| Param | Type | Default | Description |
|---|---|---|---|
threshold | scalar | 0.5 | Luminance cutoff point (0-1). Pixels brighter than this become white, darker become black. Keyframeable. |
smoothness | scalar | 0 | Width of the soft transition between black and white. 0 = hard edge. Keyframeable. |
Expose Channels
When enabled (E button on node header), adds input ports that override params via edge connections:
| Port | Type | Overrides |
|---|---|---|
threshold_in | scalar | threshold |
smoothness_in | scalar | smoothness |
How It Works
The shader computes perceptual luminance using Rec. 709 coefficients (0.2126R + 0.7152G + 0.0722B), then applies a smoothstep around the threshold point. With smoothness at 0, the result is a hard binary mask. Increasing smoothness creates a gradual falloff, producing a softer transition between black and white. Alpha is preserved from the source.
Usage Examples
Basic: High-contrast black and white
- Add a Threshold node after your image source
- Set threshold to 0.5 for a balanced split
- Adjust threshold up or down to control how much of the image goes white vs. black
Creative: Animated reveal
- Keyframe threshold from 1.0 to 0.0 over time
- White areas progressively expand, revealing the image
- Set smoothness to 0.1 for a softer edge on the reveal front
Advanced: Generate a mask for compositing
- Use Threshold to create a high-contrast matte from a source image
- Feed the result into a Matte node's matte input
- Adjust threshold and smoothness to refine the matte edge
Tips
- At smoothness 0, the output is strictly binary -- useful for generating clean masks
- A small smoothness value (0.02-0.05) avoids aliased stairstepping on the threshold edge
- Works in linear light, so the perceptual midpoint may not be at 0.5 -- adjust to taste