Skip to content

Instantly share code, notes, and snippets.

@capnmidnight
Created September 21, 2016 19:27
Show Gist options
  • Save capnmidnight/5a2bbd05e63c3870aebd8921c03a50dc to your computer and use it in GitHub Desktop.
Save capnmidnight/5a2bbd05e63c3870aebd8921c03a50dc to your computer and use it in GitHub Desktop.
vertexShader:
"varying vec2 vUv;\n\
\n\
void main() {\n\
vUv = uv;\n\
gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\
}",
fragmentShader:
"uniform float amount;\n\
uniform sampler2D tDiffuse;\n\
\n\
varying vec2 vUv;\n\
\n\
void main() {\n\
vec4 texel = texture2D( tDiffuse, vUv );\n\
vec2 p = vUv - vec2(0.5, 0.5);\n\
float scale = amount * min(1.0, 4.0 - pow(4.0 * dot(p, p), 2.0));\n\
gl_FragColor = vec4(texel.xyz * scale, texel.w);\n\
}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment