Skip to main content

LUMA_KEY

Constant LUMA_KEY 

Source
pub const LUMA_KEY: &str = "// Removes the dark (key_out 0) or bright (key_out 1) pixels by their gray, `softness` wide\n// ramps keeping part of them. The straight color is kept; only the alpha falls.\nfn effect(_uv: vec2f, src: vec4f) -> vec4f {\n    let rgb = builtin_straight(src);\n    let gray = builtin_gray(rgb);\n    let dark = builtin_smoothstep(params.threshold, params.threshold + params.softness, gray);\n    let bright = 1.0 - builtin_smoothstep(1.0 - params.threshold - params.softness, 1.0 - params.threshold, gray);\n    let keep = select(dark, bright, params.key_out == 1u);\n    return builtin_output(rgb, src.a * keep);\n}\n";
Expand description

Built-in luma-key body.