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>
This commit is contained in:
parent
6591138bbf
commit
a20d3310db
29 changed files with 160 additions and 775 deletions
38
effects/neon-edges.metal
Normal file
38
effects/neon-edges.metal
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
// Glowing outlines with a slowly cycling colour.
|
||||
// order 20
|
||||
// slider detail 1.0 12.0 5.0
|
||||
// slider glow 0.0 6.0 2.5
|
||||
// slider source 0.0 1.0 0.35
|
||||
// slider hue 0.0 1.0 0.55
|
||||
// slider cycle 0.0 1.0 0.3
|
||||
// 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);
|
||||
}
|
||||
|
||||
static float luma(Inputs in, float2 uv) {
|
||||
return dot(in.image.sample(in.smp, uv).rgb, float3(0.299, 0.587, 0.114));
|
||||
}
|
||||
|
||||
// how strongly brightness changes around this point
|
||||
static float edge(Inputs in, float2 uv) {
|
||||
float2 t = 1.5 / in.resolution;
|
||||
float dx = luma(in, uv + float2(t.x, 0.0)) - luma(in, uv - float2(t.x, 0.0));
|
||||
float dy = luma(in, uv + float2(0.0, t.y)) - luma(in, uv - float2(0.0, t.y));
|
||||
return length(float2(dx, dy));
|
||||
}
|
||||
|
||||
float4 effect(float2 uv, Inputs in) {
|
||||
float sharp = smoothstep(0.1, 0.5, edge(in, uv) * in.p.detail);
|
||||
float halo = 0.0; // edges found in a ring around this pixel = a cheap glow
|
||||
for (int i = 0; i < 12; i++) {
|
||||
float a = 6.2832 * float(i) / 12.0;
|
||||
float2 dir = float2(cos(a), sin(a)) / in.resolution;
|
||||
halo += edge(in, uv + dir * 4.0) + edge(in, uv + dir * 9.0);
|
||||
}
|
||||
halo = halo / 24.0 * in.p.detail * in.p.glow;
|
||||
|
||||
float3 tint = hueColor(in.p.hue + in.time * in.p.cycle * 0.2);
|
||||
float3 base = in.image.sample(in.smp, uv).rgb * in.p.source;
|
||||
return float4(base + tint * (sharp + halo), 1.0);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue