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>
22 lines
863 B
Metal
22 lines
863 B
Metal
// Particles spawn where you move and drift along with the motion.
|
|
// order 30
|
|
// on
|
|
// slider brightness 0.0 3.0 1.4
|
|
// slider glow 0.0 4.0 1.5
|
|
// slider hue 0.0 1.0 0.08
|
|
// 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 core = in.particles.sample(in.smp, uv).r;
|
|
float halo = 0.0;
|
|
for (int i = 0; i < 8; i++) {
|
|
float a = 6.2832 * float(i) / 8.0;
|
|
halo += in.particles.sample(in.smp, uv + float2(cos(a), sin(a)) * 5.0 / in.resolution).r;
|
|
}
|
|
float3 tint = hueColor(in.p.hue);
|
|
float3 base = in.image.sample(in.smp, uv).rgb;
|
|
return float4(base + tint * (core * in.p.brightness + halo / 8.0 * in.p.glow), 1.0);
|
|
}
|