temporal effects
This commit is contained in:
32
shaders/temporal-ghost-trail/shader.json
Normal file
32
shaders/temporal-ghost-trail/shader.json
Normal file
@@ -0,0 +1,32 @@
|
||||
{
|
||||
"id": "temporal-ghost-trail",
|
||||
"name": "Temporal Ghost Trail",
|
||||
"description": "Blends older pre-layer input frames into the current layer input for a soft temporal trail.",
|
||||
"category": "Built-in",
|
||||
"entryPoint": "shadeVideo",
|
||||
"temporal": {
|
||||
"enabled": true,
|
||||
"historySource": "preLayerInput",
|
||||
"historyLength": 12
|
||||
},
|
||||
"parameters": [
|
||||
{
|
||||
"id": "currentMix",
|
||||
"label": "Current Mix",
|
||||
"type": "float",
|
||||
"default": 0.72,
|
||||
"min": 0.0,
|
||||
"max": 1.0,
|
||||
"step": 0.01
|
||||
},
|
||||
{
|
||||
"id": "trailMix",
|
||||
"label": "Trail Mix",
|
||||
"type": "float",
|
||||
"default": 0.28,
|
||||
"min": 0.0,
|
||||
"max": 1.0,
|
||||
"step": 0.01
|
||||
}
|
||||
]
|
||||
}
|
||||
11
shaders/temporal-ghost-trail/shader.slang
Normal file
11
shaders/temporal-ghost-trail/shader.slang
Normal file
@@ -0,0 +1,11 @@
|
||||
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);
|
||||
}
|
||||
Reference in New Issue
Block a user