Last active
November 19, 2023 03:45
-
-
Save sorskoot/b012be0777f5689e914863ef392cb427 to your computer and use it in GitHub Desktop.
OBS Shader noise glitch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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