Skip to main content

SET_MATTE

Constant SET_MATTE 

Source
pub const SET_MATTE: &str = "// The source kept where the `matte` input covers it: its alpha, or its luminance over black\n// (BT.709 on linear light, times alpha, as a track matte reads it), optionally inverted.\nfn effect(uv: vec2f, src: vec4f) -> vec4f {\n    let m = sample_matte(uv);\n    let linear = builtin_decode3(clamp(builtin_straight(m), vec3f(0.0), vec3f(1.0)));\n    let coverage = select(m.a, builtin_luminance(linear) * m.a, params.mode == 1u);\n    let kept = select(coverage, 1.0 - coverage, params.invert != 0u);\n    return src * clamp(kept, 0.0, 1.0);\n}\n";
Expand description

Built-in body keeping the source where its matte input covers it.