Nebula Heart

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

Cardiac pulsing gas cloud with electric arcs.

Tags: 2D, Nebula, Heart, Space

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)

// Nebula Heart - Cardiac pulsing gas cloud
// Organic rhythm in space

float hash(vec2 p) { return fract(sin(dot(p, vec2(127.1, 311.7))) * 43758.5453); }

float noise(vec2 p) {
    vec2 i = floor(p);
    vec2 f = fract(p);
    f = f * f * (3.0 - 2.0 * f);
    return mix(mix(hash(i), hash(i + vec2(1.0, 0.0)), f.x),
               mix(hash(i + vec2(0.0, 1.0)), hash(i + vec2(1.0, 1.0)), f.x), f.y);
}

float fbm(vec2 p) {
    float v = 0.0, a = 0.5;
    for(int i = 0; i < 5; i++) {
        v += a * noise(p);
        p *= 2.0; a *= 0.5;
    }
    return v;
}

// Heart SDF
float sdHeart(vec2 uv) {
    uv.y -= 0.25;
    float a = atan(uv.x, uv.y);
    float r = length(uv);
    
    // Heart shape in polar
    float heartR = 0.5 * (1.0 - abs(a) / 3.14159) * (0.5 + 0.5 * cos(a));
    return r - heartR;
}

void mainImage(out vec4 fragColor, in vec2 fragCoord) {
    vec2 uv = (fragCoord - 0.5 * iResolution.xy) / iResolution.y;
    
    // Heartbeat rhythm
    float beat = sin(iTime * 3.0) * 0.5 + 0.5;
    float pulse = pow(beat, 3.0) * 0.15 + 1.0;
    
    // Space background
    vec3 col = vec3(0.02, 0.0, 0.04);
    
    // Distant stars
    float star = hash(uv * 200.0);
    star = pow(star, 30.0);
    col += vec3(0.9, 0.8, 1.0) * star;
    
    // Heart nebula
    vec2 heartUV = uv / pulse;
    float d = sdHeart(heartUV);
    
    // Nebula texture
    vec2 nebulaUV = heartUV * 2.0 + iTime * 0.1;
    float nebula = fbm(nebulaUV);
    
    // Heart mask
    float heart = smoothstep(0.1, 0.0, d);
    float glow = smoothstep(0.3, 0.0, d) * 0.5;
    
    // Pink/purple nebula colors
    vec3 nebulaCol = mix(
        vec3(0.9, 0.2, 0.5), // Pink
        vec3(0.6, 0.2, 0.9), // Purple
        nebula + heartUV.y * 0.5
    );
    
    col += nebulaCol * heart * nebula;
    col += nebulaCol * glow * 0.3;
    
    // Electric arcs across heart
    float arc = sin(heartUV.x * 20.0 + iTime * 5.0) * 0.5 + 0.5;
    arc *= smoothstep(0.05, 0.0, abs(d));
    col += vec3(1.0, 0.9, 0.5) * arc * 0.5;
    
    // Outer aura pulsing
    float aura = smoothstep(0.5, 0.2, d) * (0.3 + 0.7 * beat);
    col += vec3(0.9, 0.4, 0.6) * aura * 0.2;
    
    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