Thresholding is a common image processing effect for binarizing an image: converting it to one-bit color. It's one of Photoshop's basic image adjustments.
texture2d
(colorTexture, fragmentTexCoord).rgb
dot
(c, vec3
(0.213
, 0.715
, 0.072
))0.5
gl_FragColor
← vec4
(1.0
, 1.0
, 1.0
, 1.0
)gl_FragColor
← vec4
(0.0
, 0.0
, 0.0
, 1.0
)If the luminance of the input is greater than some cutoff value, then the output is white. Otherwise, black. This cutoff value can easily be parameterized using a uniform.