Skip to main content

EMBOSS

Constant EMBOSS 

Source
pub const EMBOSS: &str = "// Relief lit from `angle`: the luminance ahead minus the luminance behind, about mid gray.\n// Premultiplied values, so the edges of the alpha stand out too.\nfn effect(uv: vec2f, src: vec4f) -> vec4f {\n    let angle = radians(params.angle);\n    let offset = vec2f(cos(angle), -sin(angle)) * params.distance / builtin_aspect();\n    let ahead = sample_src(uv + offset);\n    let behind = sample_src(uv - offset);\n    let relief = params.strength * (builtin_luminance(ahead.rgb) - builtin_luminance(behind.rgb));\n    let gray = vec3f(0.5 + relief);\n    let colored = builtin_straight(src) + vec3f(relief);\n    return builtin_output(select(gray, colored, params.keep_color != 0u), src.a);\n}\n";
Expand description

Built-in emboss body: relief from a luminance difference.