Snapshot before the Python POC is removed. The POC (main.py, effects.py, panel.py, shaders.py, effects/*.glsl, flake.nix) is the reference for the native app under native/. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
18 lines
779 B
Metal
18 lines
779 B
Metal
// Halftone dots sized by brightness; dots turn hot orange wherever something moves.
|
|
// order 70
|
|
// slider cell 4.0 40.0 12.0
|
|
// slider heat 0.0 20.0 8.0
|
|
float4 effect(float2 uv, Inputs in) {
|
|
float2 grid = in.resolution / in.p.cell;
|
|
float2 centre = (floor(uv * grid) + 0.5) / grid;
|
|
float3 c = in.image.sample(in.smp, centre).rgb;
|
|
float luma = dot(c, float3(0.299, 0.587, 0.114));
|
|
|
|
float radius = 0.5 * sqrt(luma);
|
|
float dist = length(fract(uv * grid) - 0.5);
|
|
float mask = 1.0 - smoothstep(radius - 0.05, radius + 0.05, dist);
|
|
|
|
float moved = length(in.camera.sample(in.smp, centre).rgb - in.last.sample(in.smp, centre).rgb);
|
|
float3 hot = mix(c, float3(1.0, 0.35, 0.1), clamp(moved * in.p.heat, 0.0, 1.0));
|
|
return float4(hot * mask, 1.0);
|
|
}
|