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