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,32 @@
{
"id": "temporal-low-fps",
"name": "Temporal Low FPS",
"description": "Holds older source frames to create a deliberate choppy playback look.",
"category": "Built-in",
"entryPoint": "shadeVideo",
"temporal": {
"enabled": true,
"historySource": "source",
"historyLength": 8
},
"parameters": [
{
"id": "holdFrames",
"label": "Hold Frames",
"type": "float",
"default": 3.0,
"min": 0.0,
"max": 7.0,
"step": 0.1
},
{
"id": "blendAmount",
"label": "Blend",
"type": "float",
"default": 1.0,
"min": 0.0,
"max": 1.0,
"step": 0.01
}
]
}

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));
}