Skip to content

Instantly share code, notes, and snippets.

@ykob
Last active July 18, 2018 00:45
Show Gist options
  • Save ykob/08f335981f2f95dcf8d8d525a9a9e7b6 to your computer and use it in GitHub Desktop.
Save ykob/08f335981f2f95dcf8d8d525a9a9e7b6 to your computer and use it in GitHub Desktop.

Revisions

  1. ykob revised this gist Apr 27, 2016. 1 changed file with 3 additions and 3 deletions.
    6 changes: 3 additions & 3 deletions mosaic.fs
    Original file line number Diff line number Diff line change
    @@ -9,10 +9,10 @@ void main() {
    vec4 color = vec4(0.0);
    vec2 offset = vec2(mod(gl_FragCoord.x, mosaic), mod(gl_FragCoord.y, mosaic));

    for (float x = 0.0; x <= mosaic - 1.0; x += 1.0){
    for (float y = 0.0; y <= mosaic - 1.0; y += 1.0){
    for (float x = 0.0; x < mosaic; x++){
    for (float y = 0.0; y < mosaic; y++){
    color += texture2D(texture, vUv - (offset + vec2(x, y)) / resolution);
    }
    }
    gl_FragColor = color / pow(mosaic, 2.0);
    }
    }
  2. ykob revised this gist Apr 26, 2016. 1 changed file with 9 additions and 3 deletions.
    12 changes: 9 additions & 3 deletions mosaic.fs
    Original file line number Diff line number Diff line change
    @@ -3,10 +3,16 @@ uniform sampler2D texture;

    varying vec2 vUv;

    const float mosaic = 16.0;
    const float mosaic = 12.0;

    void main() {
    vec4 color = vec4(0.0);
    vec2 offset = vec2(mod(gl_FragCoord.x, mosaic), mod(gl_FragCoord.y, mosaic));
    vec4 color = texture2D(texture, vUv - offset / resolution);
    gl_FragColor = color;

    for (float x = 0.0; x <= mosaic - 1.0; x += 1.0){
    for (float y = 0.0; y <= mosaic - 1.0; y += 1.0){
    color += texture2D(texture, vUv - (offset + vec2(x, y)) / resolution);
    }
    }
    gl_FragColor = color / pow(mosaic, 2.0);
    }
  3. ykob revised this gist Apr 26, 2016. 1 changed file with 1 addition and 2 deletions.
    3 changes: 1 addition & 2 deletions mosaic.fs
    Original file line number Diff line number Diff line change
    @@ -6,8 +6,7 @@ varying vec2 vUv;
    const float mosaic = 16.0;

    void main() {
    vec4 color = vec4(0.0);
    vec2 offset = vec2(mod(gl_FragCoord.x, mosaic), mod(gl_FragCoord.y, mosaic));
    color = texture2D(texture, vUv - offset / resolution);
    vec4 color = texture2D(texture, vUv - offset / resolution);
    gl_FragColor = color;
    }
  4. ykob revised this gist Apr 26, 2016. 1 changed file with 1 addition and 4 deletions.
    5 changes: 1 addition & 4 deletions mosaic.fs
    Original file line number Diff line number Diff line change
    @@ -7,10 +7,7 @@ const float mosaic = 16.0;

    void main() {
    vec4 color = vec4(0.0);
    vec2 offset = vec2(
    mod(gl_FragCoord.x, mosaic),
    mod(gl_FragCoord.y, mosaic)
    );
    vec2 offset = vec2(mod(gl_FragCoord.x, mosaic), mod(gl_FragCoord.y, mosaic));
    color = texture2D(texture, vUv - offset / resolution);
    gl_FragColor = color;
    }
  5. ykob revised this gist Apr 26, 2016. 1 changed file with 7 additions and 10 deletions.
    17 changes: 7 additions & 10 deletions mosaic.fs
    Original file line number Diff line number Diff line change
    @@ -3,17 +3,14 @@ uniform sampler2D texture;

    varying vec2 vUv;

    const float mosaic = 12.0;
    const float mosaic = 16.0;

    void main() {
    vec4 color = vec4(0.0);
    float offsetX = mod(gl_FragCoord.x, mosaic) / resolution.x;
    float offsetY = mod(gl_FragCoord.y, mosaic) / resolution.y;

    for(float x = 0.0; x <= mosaic - 1.0; x += 1.0){
    for(float y = 0.0; y <= mosaic - 1.0; y += 1.0){
    color += texture2D(texture, vUv - vec2(offsetX, offsetY));
    }
    }
    gl_FragColor = color / pow(mosaic, 2.0);
    vec2 offset = vec2(
    mod(gl_FragCoord.x, mosaic),
    mod(gl_FragCoord.y, mosaic)
    );
    color = texture2D(texture, vUv - offset / resolution);
    gl_FragColor = color;
    }
  6. ykob created this gist Apr 26, 2016.
    19 changes: 19 additions & 0 deletions mosaic.fs
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,19 @@
    uniform vec2 resolution;
    uniform sampler2D texture;

    varying vec2 vUv;

    const float mosaic = 12.0;

    void main() {
    vec4 color = vec4(0.0);
    float offsetX = mod(gl_FragCoord.x, mosaic) / resolution.x;
    float offsetY = mod(gl_FragCoord.y, mosaic) / resolution.y;

    for(float x = 0.0; x <= mosaic - 1.0; x += 1.0){
    for(float y = 0.0; y <= mosaic - 1.0; y += 1.0){
    color += texture2D(texture, vUv - vec2(offsetX, offsetY));
    }
    }
    gl_FragColor = color / pow(mosaic, 2.0);
    }