-
-
Save rgngl/5565102 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
// warping hexagons, WIP. @psonice_cw | |
// I'm sure there's a less fugly way of making a hexagonal grid, but hey :) | |
// Maybe - Try this... | |
// Simplify! | |
#ifdef GL_ES | |
precision mediump float; | |
#endif | |
uniform float time; | |
// 1 on edges, 0 in middle | |
float hex(vec2 p) { | |
p.x *= 0.57735*2.0; | |
p.y += mod(floor(p.x), 2.0)*0.5; | |
p = abs((mod(p, 1.0) - 0.5)); | |
return abs(max(p.x*1.5 + p.y, p.y*2.0) - 1.0); | |
} | |
void main(void) { | |
vec2 pos = gl_FragCoord.xy; | |
vec2 p = pos/20.0; | |
float r = (1.0 -0.7)*0.5; | |
gl_FragColor = vec4(smoothstep(0.0, r + 0.05, hex(p))); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment