Sha256: 301313329a675afe7743ac5067b0b571826caa144b78be3c32cfffc7c5ef0dce

Contents?: true

Size: 1.25 KB

Versions: 21

Compression:

Stored size: 1.25 KB

Contents

#version 330 core

// Colorful Voronoi
// By: Brandon Fogerty
// bfogerty at gmail dot com
// xdpixel.com

#ifdef GL_ES
precision mediump float;
#endif

uniform float time;
uniform vec2 mouse;
uniform vec2 resolution;
out vec4 color_out;

vec2 hash(vec2 p)
{
    mat2 m = mat2(  13.85, 47.77,
                    99.41, 88.48
                );

    return fract(sin(m*p) * 46738.29);
}

float voronoi(vec2 p)
{
    vec2 g = floor(p);
    vec2 f = fract(p);

    float distanceToClosestFeaturePoint = 1.0;
    for(int y = -1; y <= 1; y++)
    {
        for(int x = -1; x <= 1; x++)
        {
            vec2 latticePoint = vec2(x, y);
            float currentDistance = distance(latticePoint, f);
            distanceToClosestFeaturePoint = min(distanceToClosestFeaturePoint, currentDistance);
        }
    }

    return distanceToClosestFeaturePoint;
}

void main( void )
{
    vec2 uv = ( gl_FragCoord.xy / resolution.xy ) * 2.0 - 1.0;
    uv.x *= resolution.x / resolution.y;

    float offset = voronoi(uv*10.0 + vec2(time));
    float t = 1.0/abs(((uv.x + sin(uv.y + time)) + offset) * 30.0);

    float r = voronoi( uv * 1.0 ) * 10.0;
    if (r < 3.7) { r = 0.0; }
    vec3 finalColor = vec3(10.0 * uv.y, 2.0, 1.0 * r) * t;
    
    color_out = vec4(finalColor, 1.0 );
}

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
pixo-0.4.5 ext/pixo/patterns/bubbles.glsl
pixo-0.4.4 ext/pixo/patterns/bubbles.glsl
pixo-0.4.3 ext/pixo/patterns/bubbles.glsl
pixo-0.4.2 ext/pixo/patterns/bubbles.glsl
pixo-0.4.1 ext/pixo/patterns/bubbles.glsl
pixo-0.4.0 ext/pixo/patterns/bubbles.glsl
pixo-0.3.2 ext/pixo/patterns/bubbles.glsl
pixo-0.3.1 ext/pixo/patterns/bubbles.glsl
pixo-0.3.0 ext/pixo/patterns/bubbles.glsl
pixo-0.2.6 ext/pixo/patterns/bubbles.glsl
pixo-0.2.5 ext/pixo/patterns/bubbles.glsl
pixo-0.2.4 ext/pixo/patterns/bubbles.glsl
pixo-0.2.3 ext/pixo/patterns/bubbles.glsl
pixo-0.2.2 ext/pixo/patterns/bubbles.glsl
pixo-0.2.1 ext/pixo/patterns/bubbles.glsl
pixo-0.2.0 ext/pixo/patterns/bubbles.glsl
pixo-0.1.4 ext/pixo/patterns/bubbles.glsl
pixo-0.1.3 ext/pixo/patterns/bubbles.glsl
pixo-0.1.2 ext/pixo/patterns/bubbles.glsl
pixo-0.1.1 ext/pixo/patterns/bubbles.glsl