Skip to content

Instantly share code, notes, and snippets.

@derplak
Forked from sorskoot/OBS RGB Glitch Shader.hlsl
Created February 2, 2023 22:23
Show Gist options
  • Save derplak/31848b4f48683e224b616998dec567db to your computer and use it in GitHub Desktop.
Save derplak/31848b4f48683e224b616998dec567db to your computer and use it in GitHub Desktop.
OBS RGB Glitch shader
uniform float speed;
uniform float stepsize;
uniform float amount;
float4 mainImage(VertData v_in) : TARGET
{
float time = elapsed_time*speed;
float glitch = 0;
if( frac(sin(time) * cos(v_in.uv.y*sin(time*1.45))) > amount) glitch=stepsize;
float4 g = image.Sample(textureSampler, float2(v_in.uv.x, v_in.uv.y));
float4 g2 = image.Sample(textureSampler, float2(v_in.uv.x + glitch, v_in.uv.y));
float4 g3 = image.Sample(textureSampler, float2(v_in.uv.x - glitch, v_in.uv.y));
return float4(g3.r,g.g,g2.b,1);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment