temporal effects

This commit is contained in:
2026-05-02 19:23:03 +10:00
parent 2a0eea936d
commit 1d9bf151ce
13 changed files with 786 additions and 7 deletions

View File

@@ -0,0 +1,15 @@
float4 shadeVideo(ShaderContext context)
{
float clampedHoldFrames = clamp(holdFrames, 0.0, 7.0);
int lowerHoldLength = int(floor(clampedHoldFrames)) + 1;
int upperHoldLength = min(lowerHoldLength + 1, 8);
float fractional = frac(clampedHoldFrames);
int lowerPhase = int(context.frameCount) % lowerHoldLength;
int upperPhase = int(context.frameCount) % upperHoldLength;
float4 lowerHeld = lowerPhase == 0 ? context.sourceColor : sampleSourceHistory(lowerPhase - 1, context.uv);
float4 upperHeld = upperPhase == 0 ? context.sourceColor : sampleSourceHistory(upperPhase - 1, context.uv);
float4 held = lerp(lowerHeld, upperHeld, fractional);
return lerp(context.sourceColor, held, clamp(blendAmount, 0.0, 1.0));
}