Example shaders
Some checks failed
CI / Native Windows Build And Tests (push) Failing after 7s
CI / React UI Build (push) Has been cancelled
CI / Windows Release Package (push) Has been cancelled

This commit is contained in:
2026-05-03 15:44:22 +10:00
parent ee6dbf7510
commit 52bf8c90ea
12 changed files with 447 additions and 0 deletions

View File

@@ -0,0 +1,47 @@
{
"id": "temporal-echo",
"name": "Temporal Echo",
"description": "Blends multiple older pre-layer frames with decay and tint for configurable motion echoes.",
"category": "Temporal",
"entryPoint": "shadeVideo",
"temporal": {
"enabled": true,
"historySource": "preLayerInput",
"historyLength": 12
},
"parameters": [
{
"id": "echoAmount",
"label": "Echo Amount",
"type": "float",
"default": 0.55,
"min": 0.0,
"max": 1.0,
"step": 0.01
},
{
"id": "decay",
"label": "Decay",
"type": "float",
"default": 0.72,
"min": 0.0,
"max": 1.0,
"step": 0.01
},
{
"id": "frameStride",
"label": "Frame Stride",
"type": "float",
"default": 2.0,
"min": 1.0,
"max": 6.0,
"step": 1.0
},
{
"id": "echoTint",
"label": "Echo Tint",
"type": "color",
"default": [0.65, 0.85, 1.0, 1.0]
}
]
}

View File

@@ -0,0 +1,20 @@
float4 shadeVideo(ShaderContext context)
{
int stride = int(clamp(frameStride, 1.0, 6.0) + 0.5);
float3 echo = float3(0.0, 0.0, 0.0);
float total = 0.0;
float weight = 1.0;
for (int i = 1; i <= 6; ++i)
{
int frame = i * stride;
float3 sampleColor = sampleTemporalHistory(frame, context.uv).rgb * echoTint.rgb;
echo += sampleColor * weight;
total += weight;
weight *= saturate(decay);
}
float3 echoColor = echo / max(total, 0.0001);
float amount = saturate(echoAmount) * echoTint.a;
return float4(lerp(context.sourceColor.rgb, echoColor, amount), context.sourceColor.a);
}