Python/OpenCV proof of concept plus first native Swift port
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>
This commit is contained in:
commit
6591138bbf
27 changed files with 2076 additions and 0 deletions
20
native/effects/motion-glow.metal
Normal file
20
native/effects/motion-glow.metal
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
// Whatever moves lights up and the glow lingers. The heat is carried from frame to frame
|
||||
// in the alpha channel of this effect's own previous output.
|
||||
// order 50
|
||||
// slider sensitivity 1.0 30.0 10.0
|
||||
// slider linger 0.5 0.99 0.93
|
||||
// slider dim 0.0 1.0 0.45
|
||||
// slider hue 0.0 1.0 0.07
|
||||
// hue 0..1 -> a fully saturated colour (0 red, 0.08 orange, 0.33 green, 0.66 blue)
|
||||
static float3 hueColor(float h) {
|
||||
return clamp(abs(fract(h + float3(0.0, 2.0 / 3.0, 1.0 / 3.0)) * 6.0 - 3.0) - 1.0, 0.0, 1.0);
|
||||
}
|
||||
|
||||
float4 effect(float2 uv, Inputs in) {
|
||||
float moved = length(in.camera.sample(in.smp, uv).rgb - in.last.sample(in.smp, uv).rgb);
|
||||
float fresh = smoothstep(0.3, 1.0, moved * in.p.sensitivity);
|
||||
float heat = max(in.prev.sample(in.smp, uv).a * in.p.linger, fresh);
|
||||
|
||||
float3 glow = hueColor(in.p.hue);
|
||||
return float4(in.image.sample(in.smp, uv).rgb * in.p.dim + glow * heat, heat);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue