accumulator blur

This commit is contained in:
2025-12-24 15:55:44 -06:00
parent 971299f062
commit 37c360dc67
3 changed files with 144 additions and 6 deletions

View File

@@ -0,0 +1,26 @@
#include <metal_stdlib>
using namespace metal;
struct FragmentIn {
float4 position [[position]];
float2 uv;
};
struct Uniforms {
float decay;
float3 padding;
};
fragment float4 fragment_main(
FragmentIn in [[stage_in]],
texture2d<float> current_tex [[texture(0)]],
texture2d<float> accum_tex [[texture(1)]],
sampler samp [[sampler(0)]],
constant Uniforms &u [[buffer(0)]]
) {
float4 current = current_tex.sample(samp, in.uv);
float4 accum = accum_tex.sample(samp, in.uv);
// Ghosting style motion blur
return max(current, accum * u.decay);
}