Moire 1

GLSL shader by merrypranxter · created 2026-02-09 · 10s loop · 2 passes

Moire funtimes

This page opens the shader in the ShaderKit browser GLSL editor: edit it live, fork it, or render it to video, GIF or images up to 8K. Also available as a full-screen view and an embeddable player.

Shader source (GLSL)

Common

#define pi acos(-1.)
#define deg pi/180.  //1 degree
#define time iTime*2.*pi/10. //sin(time) loops 10 seconds
#define R iResolution.xy //shorthand
#define ar R.x/R.y //aspect ratio
#define M iMouse //shorthand
#define xm (M.xy/R) //normalized mouse
#define nm ((xm.xy-0.5)*vec2(ar,1.)+0.5) //aspect ratio correction
vec3 cs = vec3(1.,2.,3.);
mat2 r2d(float a) {
    return mat2(cos(a),sin(a),-sin(a),cos(a));
}

Buffer A (iChannel0)

// "Moiré Meltdown"
// A maximalist interference engine for Mary Gray
// Concept: High-frequency sine waves creating ghost patterns

// --- 🎛️ CONTROLS ---
#define DENSITY 60.0      // The Moiré Knob. Higher = finer lines, more interference. (Try 100.0)
#define SPEED 0.5         // How fast the layers rotate
#define LAYERS 4.0        // How many grids we stack (Maximalism factor)
#define PSYCHEDELIA 1.0   // Color intensity

// A sharp, aggressive palette
// Lisa Frank Acid Trip - neon pinks, electric blues, hot purples
vec3 palette( float t ) {
    vec3 a = vec3(0.8, 0.5, 0.8);  // Bright base with pink/purple bias
    vec3 b = vec3(0.6, 0.5, 0.7);  // High contrast oscillation
    vec3 c = vec3(1.0, 1.2, 0.8);  // Frequency - more variation in green/blue
    vec3 d = vec3(0.0, 0.6, 0.8);  // Phase shift - hot pink to cyan spectrum
    return a + b*cos( 6.28318*(c*t+d) );
}

// Rotation matrix
mat2 rot(float a) {
    float s = sin(a);
    float c = cos(a);
    return mat2(c, -s, s, c);
}

void mainImage( out vec4 fragColor, in vec2 fragCoord ) {
    
    // 1. Setup Space
    vec2 uv = (fragCoord * 2.0 - iResolution.xy) / iResolution.y;
    vec2 uv0 = uv;
    vec3 finalColor = vec3(0.0);
    
    // 2. The Interference Loop
    for (float i = 0.0; i < LAYERS; i++) {
        
        // Warping the Space (The Glitch)
        // We distort the grid before we draw it. 
        uv = fract(uv * 1.1) - 0.5;
        
        // Rotate each layer in opposite directions
        float direction = (mod(i, 2.0) == 0.0) ? 1.0 : -1.0;
        uv *= rot(iTime * SPEED * direction);

        // 3. The Moiré Generator
        // We create a "Distance Field" of concentric rings
        // The DENSITY is so high that the screen pixels can't keep up, creating Moiré.
        float d = sin(length(uv) * DENSITY + iTime);
        
        // Sharpen the rings to make them harsh
        d = abs(d);
        d = smoothstep(0.0, 0.1, d); // Make lines crisp
        
        // 4. Invert colors per layer for "X-Ray" look
        d = 0.1 / d; 
        
        // 5. Color Mapping
        // We use the distance and the original position to pick a color
        vec3 col = palette(length(uv0) + i*.2 + iTime*.3);
        
        // Add it to the pile
        finalColor += col * d * (0.4 / LAYERS);
    }
    
    // 6. Final Glitch: Chromatic Aberration
    // We shift the Red channel slightly to make it hurt a little (in a good way)
    finalColor.r += 0.1 * sin(uv0.y * 20.0);

    fragColor = vec4(finalColor * PSYCHEDELIA, 1.0);
}

Image

Not used

More shaders by merrypranxter

Browse all public shaders · All shaders by merrypranxter · ShaderKit home

Vibe Mode BETA
💰 ~0 credits
Uniforms
FPS: 0
Time: 0
Resolution: 0 x 0

Account

FPS: -- Time: -- --×-- 1x