Multi pass test
This commit is contained in:
38
shaders/multipass-test/shader.slang
Normal file
38
shaders/multipass-test/shader.slang
Normal file
@@ -0,0 +1,38 @@
|
||||
float ringMask(float2 uv)
|
||||
{
|
||||
float2 centered = uv * 2.0 - 1.0;
|
||||
float radius = length(centered);
|
||||
float ring = 1.0 - smoothstep(0.015, 0.035, abs(radius - 0.55));
|
||||
float cross = 1.0 - smoothstep(0.006, 0.018, min(abs(centered.x), abs(centered.y)));
|
||||
return saturate(max(ring, cross));
|
||||
}
|
||||
|
||||
float gridMask(float2 uv)
|
||||
{
|
||||
float2 cell = abs(frac(uv * max(scale, 1.0)) - 0.5);
|
||||
float line = 1.0 - smoothstep(0.455, 0.495, max(cell.x, cell.y));
|
||||
return saturate(line * 0.55);
|
||||
}
|
||||
|
||||
float4 buildMask(ShaderContext context)
|
||||
{
|
||||
float mask = saturate(max(ringMask(context.uv), gridMask(context.uv)));
|
||||
return float4(mask, context.uv.x, context.uv.y, 1.0);
|
||||
}
|
||||
|
||||
float4 applyMask(ShaderContext context)
|
||||
{
|
||||
float4 generated = sampleVideo(context.uv);
|
||||
float mask = generated.r;
|
||||
float2 encodedUv = generated.gb;
|
||||
float checker = step(0.5, frac((encodedUv.x + encodedUv.y) * max(scale, 1.0)));
|
||||
float3 testColor = lerp(float3(0.0, 0.75, 1.0), float3(1.0, 0.1, 0.85), checker);
|
||||
float3 base = context.sourceColor.rgb * 0.35;
|
||||
float3 color = lerp(base, testColor, mask * saturate(intensity));
|
||||
return float4(color, context.sourceColor.a);
|
||||
}
|
||||
|
||||
float4 shadeVideo(ShaderContext context)
|
||||
{
|
||||
return applyMask(context);
|
||||
}
|
||||
Reference in New Issue
Block a user