temporal effects
This commit is contained in:
32
shaders/temporal-low-fps/shader.json
Normal file
32
shaders/temporal-low-fps/shader.json
Normal 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
|
||||
}
|
||||
]
|
||||
}
|
||||
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