obs-studio/plugins/obs-transitions/data/swipe_transition.effect
jpark37 01565a0293 obs-transitions: More HDR support
Updated luma wipe, slide, and swipe.
2022-04-18 05:24:12 -07:00

56 lines
1.1 KiB
Plaintext

uniform float4x4 ViewProj;
uniform texture2d tex_a;
uniform texture2d tex_b;
uniform float2 swipe_val;
sampler_state textureSampler {
Filter = Linear;
AddressU = Clamp;
AddressV = Clamp;
};
struct VertData {
float4 pos : POSITION;
float2 uv : TEXCOORD0;
};
VertData VSDefault(VertData v_in)
{
VertData vert_out;
vert_out.pos = mul(float4(v_in.pos.xyz, 1.0), ViewProj);
vert_out.uv = v_in.uv;
return vert_out;
}
float srgb_nonlinear_to_linear_channel(float u)
{
return (u <= 0.04045) ? (u / 12.92) : pow((u + 0.055) / 1.055, 2.4);
}
float3 srgb_nonlinear_to_linear(float3 v)
{
return float3(srgb_nonlinear_to_linear_channel(v.r), srgb_nonlinear_to_linear_channel(v.g), srgb_nonlinear_to_linear_channel(v.b));
}
float4 PSSwipe(VertData v_in) : TARGET
{
float2 swipe_uv = v_in.uv + swipe_val;
float4 outc;
outc = (swipe_uv.x - saturate(swipe_uv.x) != 0.0) ||
(swipe_uv.y - saturate(swipe_uv.y) != 0.0)
? tex_b.Sample(textureSampler, v_in.uv)
: tex_a.Sample(textureSampler, swipe_uv);
return outc;
}
technique Swipe
{
pass
{
vertex_shader = VSDefault(v_in);
pixel_shader = PSSwipe(v_in);
}
}