LF shroom1

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

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 420 Hyper-Shroom (Clean)"
// Concept: Refractive Glass Mushroom on Acid Background
// Modification: Removed the dark drop-shadow circle

// --- 🎛️ CONTROLS ---
#define ZOOM 3.0           // Pattern density
#define SPEED 0.2          // Background flow speed
#define SHROOM_SIZE 0.8    // Size of the shroom
#define TRIP_FACTOR 2.0    // Wiggle intensity

// --- 🎨 PALETTE ---
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 MUSHROOM SHAPE ---
float map(vec3 p) {
    vec3 p_orig = p;
    
    // Rotation
    p.yz *= rot(0.5); 
    p.xz *= rot(iTime * 0.5); 
    
    // 1. The Cap 
    vec3 p_cap = p;
    p_cap.y -= 0.5; 
    float cap = length(p_cap) - 0.7; 
    cap = max(cap, -p_cap.y + 0.2); 
    cap = max(cap, -(length(p_cap - vec3(0, -0.5, 0)) - 0.6));
    
    // 2. The Stem 
    vec3 p_stem = p;
    p_stem.y += 0.4;
    p_stem.x += sin(p_stem.y * 3.0 + iTime * 5.0) * 0.1;
    float stem = length(p_stem.xz) - 0.25 + p_stem.y * 0.1; 
    stem = max(stem, abs(p_stem.y) - 0.8); 

    // Smooth Blend
    float d = min(cap, stem);
    float k = 0.2;
    float h = clamp( 0.5+0.5*(stem-cap)/k, 0.0, 1.0 );
    return mix( stem, cap, h ) - k*h*(1.0-h);
}

// Background Pattern Generator
vec3 getPattern(vec2 uv) {
    vec2 uv0 = uv;
    for (float i = 0.0; i < 3.0; i++) {
        uv.x += sin(uv.y * 2.0 + iTime * SPEED);
        uv.y += cos(uv.x * 2.0 - iTime * SPEED);
        uv *= 1.1; 
    }
    float d = sin(uv.x * ZOOM) * sin(uv.y * ZOOM);
    vec3 col = palette(length(uv0) + d * 0.5 + iTime * 0.2);
    
    if (d > 0.5) col = 1.0 - col;
    return col;
}

void mainImage( out vec4 fragColor, in vec2 fragCoord ) {
    
    vec2 uv = (fragCoord * 2.0 - iResolution.xy) / iResolution.y;
    
    // 1. Render Background
    vec3 bgCol = getPattern(uv);

    // 2. Raymarch Mushroom
    vec3 ro = vec3(0.0, 0.0, -3.0); 
    vec3 rd = normalize(vec3(uv, 1.0)); 
    
    float t = 0.0;
    bool hit = false;
    vec3 p = vec3(0.0);
    
    for(int i = 0; i < 60; i++) {
        p = ro + rd * t;
        float d = map(p);
        if (d < 0.01) { hit = true; break; }
        if (t > 10.0) break;
        t += d;
    }

    vec3 finalColor = bgCol;

    if (hit) {
        // 3. Optical Illusion (Refraction)
        vec2 e = vec2(0.01, 0.0);
        vec3 normal = normalize(vec3(
            map(p+e.xyy) - map(p-e.xyy),
            map(p+e.yxy) - map(p-e.yxy),
            map(p+e.yyx) - map(p-e.yyx)
        ));

        // Refract the pattern behind it
        vec2 distortedUV = uv + normal.xy * 0.5;
        vec3 shroomCol = getPattern(distortedUV * 2.0); 
        
        // Invert colors
        shroomCol = 1.0 - shroomCol;
        
        // Rim Light
        float rim = 1.0 - dot(normal, -rd);
        rim = pow(rim, 3.0);
        shroomCol += vec3(1.0) * rim;

        finalColor = shroomCol;
    }
    
    // (SHADOW BLOCK DELETED HERE)

    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