Skip to main content

RGB_SPLIT

Constant RGB_SPLIT 

Source
pub const RGB_SPLIT: &str = "// The red channel from one side, blue from the other: along `angle`, or away from the\n// centre. Each channel comes with its own sample\'s alpha, so rgb stays within alpha.\nfn effect(uv: vec2f, src: vec4f) -> vec4f {\n    let angle = radians(params.angle);\n    let along = vec2f(cos(angle), -sin(angle)) * params.amount / builtin_aspect();\n    let shift = select(along, (uv - vec2f(0.5)) * params.amount * 4.0, params.mode == 1u);\n    let red = sample_src(uv + shift);\n    let blue = sample_src(uv - shift);\n    let alpha = max(src.a, max(red.a, blue.a));\n    return vec4f(red.r, src.g, blue.b, alpha);\n}\n";
Expand description

Built-in rgb-split body: red and blue sampled apart.