Skip to content

Instantly share code, notes, and snippets.

@codeaholicguy
Created November 22, 2017 16:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save codeaholicguy/8327e028f56f8a37343fd76e62f46bc2 to your computer and use it in GitHub Desktop.
Save codeaholicguy/8327e028f56f8a37343fd76e62f46bc2 to your computer and use it in GitHub Desktop.
vec4 tex00 = texture2D(textureSampler, texCoords + vec2(-off2.x, -off2.y));
vec4 tex10 = texture2D(textureSampler, texCoords + vec2(-off.x, -off2.y));
vec4 tex20 = texture2D(textureSampler, texCoords + vec2(0.0, -off2.y));
vec4 tex30 = texture2D(textureSampler, texCoords + vec2(off.x, -off2.y));
vec4 tex40 = texture2D(textureSampler, texCoords + vec2(off2.x, -off2.y));
vec4 tex01 = texture2D(textureSampler, texCoords + vec2(-off2.x, -off.y));
vec4 tex11 = texture2D(textureSampler, texCoords + vec2(-off.x, -off.y));
vec4 tex21 = texture2D(textureSampler, texCoords + vec2(0.0, -off.y));
vec4 tex31 = texture2D(textureSampler, texCoords + vec2(off.x, -off.y));
vec4 tex41 = texture2D(textureSampler, texCoords + vec2(off2.x, -off.y));
vec4 tex02 = texture2D(textureSampler, texCoords + vec2(-off2.x, 0.0));
vec4 tex12 = texture2D(textureSampler, texCoords + vec2(-off.x, 0.0));
vec4 tex22 = texture2D(textureSampler, texCoords + vec2(0.0, 0.0));
vec4 tex32 = texture2D(textureSampler, texCoords + vec2(off.x, 0.0));
vec4 tex42 = texture2D(textureSampler, texCoords + vec2(off2.x, 0.0));
vec4 tex03 = texture2D(textureSampler, texCoords + vec2(-off2.x, off.y));
vec4 tex13 = texture2D(textureSampler, texCoords + vec2(-off.x, off.y));
vec4 tex23 = texture2D(textureSampler, texCoords + vec2(0.0, off.y));
vec4 tex33 = texture2D(textureSampler, texCoords + vec2(off.x, off.y));
vec4 tex43 = texture2D(textureSampler, texCoords + vec2(off2.x, off.y));
vec4 tex04 = texture2D(textureSampler, texCoords + vec2(-off2.x, off2.y));
vec4 tex14 = texture2D(textureSampler, texCoords + vec2(-off.x, off2.y));
vec4 tex24 = texture2D(textureSampler, texCoords + vec2(0.0, off2.y));
vec4 tex34 = texture2D(textureSampler, texCoords + vec2(off.x, off2.y));
vec4 tex44 = texture2D(textureSampler, texCoords + vec2(off2.x, off2.y));
vec4 tex = tex22;
// Blur
vec4 blurred = 1.0 * tex00 + 4.0 * tex10 + 6.0 * tex20 + 4.0 * tex30 + 1.0 * tex40
+ 4.0 * tex01 + 16.0 * tex11 + 24.0 * tex21 + 16.0 * tex31 + 4.0 * tex41
+ 6.0 * tex02 + 24.0 * tex12 + 36.0 * tex22 + 24.0 * tex32 + 6.0 * tex42
+ 4.0 * tex03 + 16.0 * tex13 + 24.0 * tex23 + 16.0 * tex33 + 4.0 * tex43
+ 1.0 * tex04 + 4.0 * tex14 + 6.0 * tex24 + 4.0 * tex34 + 1.0 * tex44;
blurred /= 256.0;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment