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
17
effects/halftone.glsl
Normal file
17
effects/halftone.glsl
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
// Halftone dots sized by brightness; dots turn hot orange wherever something moves.
|
||||
uniform float cell; // 4.0 .. 40.0 = 10.0
|
||||
uniform float heat; // 0.0 .. 6.0 = 3.0
|
||||
|
||||
void main() {
|
||||
vec2 grid = resolution / cell;
|
||||
vec2 centre = (floor(uv * grid) + 0.5) / grid;
|
||||
vec3 c = texture(camera, centre).rgb;
|
||||
float luma = dot(c, vec3(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 moving = clamp(texture(motion, centre).r * heat, 0.0, 1.0);
|
||||
color = vec4(mix(c, vec3(1.0, 0.35, 0.1), moving) * mask, 1.0);
|
||||
}
|
||||
13
effects/liquid.glsl
Normal file
13
effects/liquid.glsl
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
// Liquid trails: the previous output is dragged along the motion, swirled a little,
|
||||
// and slowly fades back to the live camera.
|
||||
uniform float persistence; // 0.0 .. 0.99 = 0.92
|
||||
uniform float drag; // 0.0 .. 6.0 = 2.5
|
||||
uniform float swirl; // 0.0 .. 0.01 = 0.002
|
||||
|
||||
void main() {
|
||||
vec2 centred = uv - 0.5;
|
||||
vec2 from = uv - texture(flow, uv).xy * drag + vec2(-centred.y, centred.x) * swirl;
|
||||
vec3 trail = texture(prev, from).rgb;
|
||||
vec3 live = texture(camera, uv).rgb;
|
||||
color = vec4(mix(live, trail, persistence), 1.0);
|
||||
}
|
||||
12
effects/wave-shift.glsl
Normal file
12
effects/wave-shift.glsl
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
// RGB split that ripples down the image and gets pushed around by your movement.
|
||||
uniform float amount; // 0.0 .. 0.05 = 0.012
|
||||
uniform float waves; // 1.0 .. 80.0 = 24.0
|
||||
uniform float react; // 0.0 .. 3.0 = 1.0
|
||||
|
||||
void main() {
|
||||
vec2 d = vec2(amount * sin(uv.y * waves + time * 3.0), 0.0);
|
||||
d += texture(flow, uv).xy * react;
|
||||
color = vec4(texture(camera, uv + d).r,
|
||||
texture(camera, uv).g,
|
||||
texture(camera, uv - d).b, 1.0);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue