Created
May 25, 2019 10:58
-
-
Save MagnusThor/475cf3cae02e0e31c4c427e110341e40 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
precision highp float; | |
uniform sampler2D S; | |
uniform sampler2D R; | |
uniform vec2 X; | |
// Combines 2 buffers, blurred in directions [0,1] and [sin(120°), cos(120°)] to create hexagon | |
// bokeh pattern. Technique I got from DICE that they used in Frostbyte engine. | |
void main() { | |
gl_FragColor = vec4(0); | |
for (int i = 0; i < 10; i++) { | |
gl_FragColor += texture2D(R, gl_FragCoord.xy / vec2(1280,720) + vec2(.866,-.5) * (float(i) + .5) * .003 * vec2(1,1.77)); | |
gl_FragColor += texture2D(R, gl_FragCoord.xy / vec2(1280,720) + vec2(-.866,-.5) * (float(i) + .5) * .003 * vec2(1,1.77)); | |
gl_FragColor += texture2D(S, gl_FragCoord.xy / vec2(1280,720) + vec2(.866,-.5) * (float(i) + .5) * .003 * vec2(1,1.77)); | |
} | |
gl_FragColor /= 300.; // / 30 from above, / 10 from previous | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment