Blue noise one-sample blur variation
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
| float baseRadius = 15.0; | |
| vec2 random(vec2 p){ | |
| p = fract(p * vec2(443.897, 441.423)); | |
| p += dot(p, p.yx+19.19); | |
| return fract((p.xx+p.yx)*p.xy); | |
| } | |
| vec2 blueNoise(vec2 p) | |
| { | |
| return texture(iChannel1, p / vec2(1024.0)).rg; | |
| } | |
| void mainImage( out vec4 fragColor, in vec2 fragCoord ){ | |
| float blurRadius = baseRadius * (0.53 + 0.47*sin(iTime*1.23)); | |
| float divider = 0.5; | |
| vec2 uv = fragCoord / iResolution.xy; | |
| if (iMouse.z > 0.0) | |
| divider = iMouse.x/iResolution.x; | |
| vec2 r= (uv.x > divider) ? random(uv) : blueNoise(fragCoord); | |
| r.x*=6.28305308; | |
| vec2 cr = vec2(sin(r.x),cos(r.x))*sqrt(r.y); | |
| vec3 color = texture(iChannel0, | |
| uv+cr*(blurRadius/iResolution.xy) | |
| ).rgb; | |
| if (abs(uv.x - divider) < 0.001) | |
| color = vec3(0.0, 1.0, 0.0); | |
| fragColor = vec4(color, 1.0f); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment