motionlab/effects/colorize.metal
0xrsydn a20d3310db Go native-only: remove the Python POC, move the Swift app to the top level
Adds --check (compile every effect without camera or window), EFFECTS.md
(the contract for writing effects) and AGENTS.md. The POC stays available
at the 'poc' tag.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-05 20:33:18 +07:00

12 lines
530 B
Metal

// Recolours the picture by brightness with a smooth colour ramp.
// order 10
// slider amount 0.0 1.0 0.8
// slider palette 0.0 1.0 0.0
// slider contrast 0.5 3.0 1.2
float4 effect(float2 uv, Inputs in) {
float3 c = in.image.sample(in.smp, uv).rgb;
float luma = pow(dot(c, float3(0.299, 0.587, 0.114)), in.p.contrast);
float3 ramp = 0.5 + 0.5 * cos(6.2832 * (luma * 0.8 + in.p.palette + float3(0.55, 0.4, 0.2)));
float3 mapped = ramp * (0.15 + 0.85 * luma);
return float4(mix(c, mapped, in.p.amount), 1.0);
}