Skip to content

Instantly share code, notes, and snippets.

@sorskoot
Last active November 19, 2023 03:45
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save sorskoot/b012be0777f5689e914863ef392cb427 to your computer and use it in GitHub Desktop.
Save sorskoot/b012be0777f5689e914863ef392cb427 to your computer and use it in GitHub Desktop.
OBS Shader noise glitch
uniform float speed;
uniform float amount;
uniform float noiseLevel;
float rand(float co){
return frac(sin(dot(float2(co,co) ,float2(12.9898,78.233))) * 43758.5453);
}
float4 mainImage(VertData v_in) : TARGET
{
float time = elapsed_time*speed;
float glitch = 0;
float x = rand(v_in.uv.y/v_in.uv.x*time/speed) * noiseLevel;
float4 g = image.Sample(textureSampler, float2(v_in.uv.x, v_in.uv.y));
if(frac(sin(time) * cos(x*sin(time*1.45))) > amount){
float4 d = clamp(g, x, 1);
return float4(d.r,d.g,d.b,1);
}else{
return float4(g.r,g.g,g.b,1);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment