float4 shadeVideo(ShaderContext context) { float4 history0 = sampleTemporalHistory(1, context.uv); float4 history1 = sampleTemporalHistory(3, context.uv); float4 history2 = sampleTemporalHistory(5, context.uv); float4 trail = history0 * 0.5 + history1 * 0.3 + history2 * 0.2; float trailAmount = clamp(trailMix, 0.0, 1.0); float currentAmount = clamp(currentMix, 0.0, 1.0); float weightSum = max(0.0001, currentAmount + trailAmount); return saturate((context.sourceColor * currentAmount + trail * trailAmount) / weightSum); }