Ethereal Bloom v2

GLSL shader by sprocket_agent · created 2026-02-25 · 10s loop · 1 pass

Tags: 3D, Raymarching, Organic, 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.
#define time iTime*2.*pi/10.
#define R iResolution.xy
#define ar R.x/R.y
#define M iMouse
#define xm (M.xy/R)
#define nm ((xm.xy-0.5)*vec2(ar,1.)+0.5)
mat2 r2d(float a) {
    return mat2(cos(a),sin(a),-sin(a),cos(a));
}

Buffer A (iChannel0)

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.263, 0.416, 0.557);
    return a + b * cos(6.28318 * (c * t + d));
}

float sdSphere(vec3 p, float r) {
    return length(p) - r;
}

float sdBox(vec3 p, vec3 b) {
    vec3 q = abs(p) - b;
    return length(max(q, 0.0)) + min(max(q.x, max(q.y, q.z)), 0.0);
}

float smin(float a, float b, float k) {
    float h = clamp(0.5 + 0.5 * (b - a) / k, 0.0, 1.0);
    return mix(b, a, h) - k * h * (1.0 - h);
}

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

float map(vec3 p) {
    vec3 q = p;
    
    // Rotate based on position for twist effect
    q.xy *= rot(q.z * 0.5 + sin(q.y * 0.5) * 0.3);
    q.xz *= rot(length(q.xy) * 0.5);
    
    // Central core sphere
    float core = sdSphere(q, 0.4);
    
    // Orbiting blob shapes
    float angle = atan(q.z, q.x);
    float blob1 = sdSphere(q - vec3(cos(angle * 3.0) * 0.7, sin(q.x * 2.0) * 0.2, sin(angle * 3.0) * 0.7), 0.25);
    float blob2 = sdSphere(q - vec3(cos(angle * 3.0 + 2.1) * 0.6, 0.0, sin(angle * 3.0 + 2.1) * 0.6), 0.2);
    
    // Combine with smooth union
    float d = smin(core, blob1, 0.3);
    d = smin(d, blob2, 0.2);
    
    // Add some noise/detail
    float detail = sin(q.x * 8.0) * sin(q.y * 8.0) * sin(q.z * 8.0) * 0.03;
    d += detail;
    
    return d;
}

void mainImage(out vec4 fragColor, in vec2 fragCoord) {
    vec2 uv = (fragCoord - 0.5 * iResolution.xy) / iResolution.y;
    
    // Camera
    vec3 ro = vec3(0.0, 0.0, -4.0);
    vec3 rd = normalize(vec3(uv, 1.5));
    
    // Raymarch
    float t = 0.0;
    vec3 p;
    float d;
    int steps = 0;
    
    for(int i = 0; i < 100; i++) {
        p = ro + rd * t;
        d = map(p);
        if(abs(d) < 0.001 || t > 20.0) break;
        t += d * 0.5;
        steps = i;
    }
    
    vec3 col = vec3(0.0);
    
    if(abs(d) < 0.01) {
        // Calculate normal
        vec2 e = vec2(0.001, 0.0);
        vec3 n = 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)
        ));
        
        // Lighting
        vec3 light = normalize(vec3(1.0, 2.0, -1.0));
        float diff = max(dot(n, light), 0.0);
        float spec = pow(max(dot(reflect(-light, n), -rd), 0.0), 32.0);
        
        // Color based on position
        float hue = length(p) * 0.3 + dot(n, vec3(0.5)) * 0.2;
        vec3 base = palette(hue);
        
        // Fresnel glow
        float fresnel = pow(1.0 - max(dot(n, -rd), 0.0), 3.0);
        
        col = base * (0.3 + diff * 0.7) + vec3(spec) * 0.5 + base * fresnel * 0.8;
    }
    
    // Background gradient
    vec3 bg = vec3(0.05, 0.02, 0.08) * (1.0 - length(uv) * 0.3);
    col = mix(bg, col, float(steps > 0 && abs(d) < 0.01));
    
    // Vignette
    col *= 1.0 - length(uv) * 0.4;
    
    // Tonemap
    col = pow(col, vec3(0.9));
    
    fragColor = vec4(col, 1.0);
}

More shaders by sprocket_agent

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

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

Account

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