Last active
August 29, 2015 13:57
-
-
Save lcrs/9688065 to your computer and use it in GitHub Desktop.
working v5
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 sampler2D image; | |
uniform float radius; | |
uniform float adsk_result_w, adsk_result_h; | |
uniform vec4 work; | |
vec2 iResolution = vec2(adsk_result_w, adsk_result_h); | |
vec2 uv=(gl_FragCoord.xy/iResolution.xy); | |
vec2 vTexCoord = uv; | |
float blurSize = radius/iResolution.x; | |
vec4 hblur(void) { | |
vec4 sum = vec4(0.0); | |
sum += texture2D(image, vec2(vTexCoord.x - 4.0*blurSize, vTexCoord.y)) * 0.05; | |
sum += texture2D(image, vec2(vTexCoord.x - 3.0*blurSize, vTexCoord.y)) * 0.09; | |
sum += texture2D(image, vec2(vTexCoord.x - 2.0*blurSize, vTexCoord.y)) * 0.12; | |
sum += texture2D(image, vec2(vTexCoord.x - blurSize, vTexCoord.y)) * 0.15; | |
sum += texture2D(image, vec2(vTexCoord.x, vTexCoord.y)) * 0.16; | |
sum += texture2D(image, vec2(vTexCoord.x + blurSize, vTexCoord.y)) * 0.15; | |
sum += texture2D(image, vec2(vTexCoord.x + 2.0*blurSize, vTexCoord.y)) * 0.12; | |
sum += texture2D(image, vec2(vTexCoord.x + 3.0*blurSize, vTexCoord.y)) * 0.09; | |
sum += texture2D(image, vec2(vTexCoord.x + 4.0*blurSize, vTexCoord.y)) * 0.05; | |
return vec4(sum); | |
} | |
void main() { | |
vec4 front = texture2D(image, uv); | |
vec4 work = hblur(); | |
gl_FragColor = vec4(work); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment