LF 2

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

Tags: Abstract

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)

// "The Trapper Keeper Abduction"
// Concept: 90s Neon Paisley Background + Raymarched Chrome UFO
// The UFO is a "Torus" (Donut) deformed by sine waves to look alien.

// --- 🎛️ CONTROLS ---
#define ZOOM 3.0           // Pattern size
#define LIQUIDITY 2.0      // Background meltiness
#define UFO_SIZE 0.45      // How big the ship is
#define UFO_GLOW 0.04     // How much the ship radiates energy

// --- 🎨 PALETTE (SAME AS BEFORE) ---
vec3 palette( float t ) {
    vec3 a = vec3(0.5, 0.5, 0.5);
    vec3 b = vec3(0.5, 0.5, 0.5);
    vec3 c = vec3(1.0, 1.0, 1.0);
    vec3 d = vec3(0.00, 0.33, 0.67);
    return pow(a + b*cos( 6.28318*(c*t+d) ), vec3(0.6)); 
}

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

// --- 🛸 THE UFO MATH ---
// This function defines the 3D shape of the ship
float map(vec3 p) {
    vec3 p0 = p;
    
    // Rotate the ship constantly
    p.yz *= rot(iTime * 0.5);
    p.xz *= rot(iTime * 0.3);
    
    // SHAPE: A Torus (Donut)
    // length(vec2(length(p.xz)-radius_major, p.y)) - radius_minor
    float d = length(vec2(length(p.xz) - 0.25, p.y)) - 0.08;
    
    // ALIEN DEFORMATION
    // We add a ripple to the surface so it looks like "liquid metal"
    // This makes it look less like a donut and more like a biomech ship
    d += sin(p.x * 20.0 + iTime * 5.0) * 0.01;
    d += sin(p.y * 15.0) * 0.01;
    
    // Add a glowing energy ball in the middle
    float ball = length(p0) - 0.1;
    
    // Combine them (min = union of shapes)
    return min(d, ball);
}

void mainImage( out vec4 fragColor, in vec2 fragCoord ) {
    
    // 1. Setup Coordinates
    vec2 uv = (fragCoord * 2.0 - iResolution.xy) / iResolution.y;
    vec2 uv0 = uv;
    vec3 finalColor = vec3(0.0);
    
    // --- PART 1: THE BACKGROUND (PAISLEY) ---
    vec2 bgUV = uv;
    for (float i = 0.0; i < 4.0; i++) {
        bgUV.x += sin(bgUV.y * LIQUIDITY + iTime * 0.2);
        bgUV.y += cos(bgUV.x * LIQUIDITY - iTime * 0.2);
        bgUV *= 1.1; 
    }
    float d = sin(bgUV.x * ZOOM) * sin(bgUV.y * ZOOM);
    float d1 = smoothstep(-0.2, 0.2, d);
    vec3 bgColor = palette(length(uv0) + d * 0.5 + iTime * 0.2);
    // Chromatic aberration on background
    bgColor.r += 0.05 * sin(d * 10.0);
    bgColor.b -= 0.05 * cos(d * 10.0);
    if (d > 0.5) bgColor = 1.0 - bgColor;
    
    finalColor = bgColor; // Start with background

    // --- PART 2: THE UFO (RAYMARCHING) ---
    vec3 ro = vec3(0.0, 0.0, -1.0); // Camera position (back up a bit)
    vec3 rd = normalize(vec3(uv, 1.0)); // Ray direction
    float t = 0.0;
    
    for(int i = 0; i < 60; i++) {
        vec3 p = ro + rd * t;
        float dist = map(p);
        
        // If we hit the ship
        if (dist < 0.001) {
            // SHADING THE SHIP
            // We use the normal (surface angle) to color it
            // This makes it look shiny and metallic
            vec3 col = vec3(1.0); // Base white
            col *= palette(length(p) * 2.0 + iTime); // Reflect the rainbow palette
            
            // Rim lighting (make edges glow)
            float rim = 1.0 - abs(dot(rd, normalize(p)));
            col += vec3(0.0, 1.0, 1.0) * pow(rim, 3.0); // Cyan edge glow
            
            finalColor = col; 
            break;
        }
        
        t += dist;
        
        // Add a "Forcefield" Glow around it
        // Even if we don't hit the ship, being close adds light
        finalColor += vec3(0.2, 0.0, 0.8) * UFO_GLOW / (abs(dist) + 0.01);
    }

    fragColor = vec4(finalColor, 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