temporal effects
This commit is contained in:
15
shaders/temporal-low-fps/shader.slang
Normal file
15
shaders/temporal-low-fps/shader.slang
Normal 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));
|
||||
}
|
||||
Reference in New Issue
Block a user