Last active
March 16, 2016 16:00
-
-
Save jrsa/b0f0920cb9b0e4f83548 to your computer and use it in GitHub Desktop.
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
kernel vec4 basicBlur(sampler image, float width) | |
{ | |
// get coordinates of the current pixel | |
vec2 center = samplerCoord(image); | |
// sum the current pixel and 4 pixels around it | |
vec4 result = sample(image, center); | |
result += sample(image, samplerTransform(image, samplerCoord(image) + vec2(-width, -width))); | |
result += sample(image, samplerTransform(image, samplerCoord(image) + vec2( width, -width))); | |
result += sample(image, samplerTransform(image, samplerCoord(image) + vec2( width, width))); | |
result += sample(image, samplerTransform(image, samplerCoord(image) + vec2(-width, width))); | |
// scale result | |
return result * vec2(0.2); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment