Nebula Core

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

Domain-warped fbm nebula with central glowing core, star field, and particle dust. Organic flowing shapes with purple/cyan/gold palette.

Tags: 2D, Nebula, FBM, Domain Warping, 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 Core v2 - Fixed for still image renders
#define PI 3.14159265359

float hash(float n) { return fract(sin(n) * 43758.5453123); }
vec2 hash2(vec2 p) { return fract(sin(vec2(dot(p, vec2(127.1, 311.7)), dot(p, vec2(269.5, 183.3)))) * 43758.5453); }

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

float fbm(vec2 p) {
    float value = 0.0;
    float amplitude = 0.5;
    float frequency = 1.0;
    for(int i = 0; i < 4; i++) {
        value += amplitude * noise(p * frequency);
        amplitude *= 0.5;
        frequency *= 2.0;
    }
    return value;
}

float warp(vec2 p, float t) {
    vec2 q = vec2(fbm(p + vec2(0.0, 0.0)), fbm(p + vec2(5.2, 1.3)));
    vec2 r = vec2(
        fbm(p + 4.0 * q + vec2(1.7 - t * 0.15, 9.2)),
        fbm(p + 4.0 * q + vec2(8.3 - t * 0.126, 2.8))
    );
    return fbm(p + 4.0 * r);
}

vec3 stars(vec2 uv, float t) {
    vec2 seed = floor(uv * 200.0);
    float star = hash(dot(seed, vec2(12.9898, 78.233)));
    if(star > 0.997) {
        float twinkle = 0.7 + 0.3 * sin(t * 3.0 + star * 10.0);
        return vec3(1.0) * twinkle;
    }
    return vec3(0.0);
}

vec3 nebulaPalette(float v, float t) {
    vec3 purple = vec3(0.4, 0.1, 0.6);
    vec3 cyan = vec3(0.1, 0.5, 0.7);
    vec3 gold = vec3(0.8, 0.5, 0.2);
    vec3 pink = vec3(0.7, 0.3, 0.5);
    
    float phase = v * 3.0 + t * 0.2;
    vec3 col = mix(purple, cyan, sin(phase) * 0.5 + 0.5);
    col = mix(col, gold, sin(phase * 1.3 + 1.0) * 0.3 + 0.3);
    col = mix(col, pink, smoothstep(0.6, 0.9, v));
    return col * (0.4 + v * 0.6); // Reduced intensity
}

void mainImage(out vec4 fragColor, in vec2 fragCoord) {
    vec2 uv = (fragCoord - 0.5 * iResolution.xy) / iResolution.y;
    float t = 0.5; // Fixed time for still render
    
    float dist = length(uv);
    float nebula = warp(uv * 2.0 + vec2(0.05), t);
    
    // Reduced core glow for still image
    float coreGlow = 1.0 / (1.0 + dist * dist * 12.0);
    coreGlow = pow(coreGlow, 0.8) * 0.6; // Reduced multiplier
    
    float density = nebula * (1.0 - smoothstep(0.0, 1.5, dist));
    density = pow(density, 1.5);
    
    vec3 col = nebulaPalette(density + nebula * 0.3, t);
    
    vec3 coreColor = vec3(1.0, 0.9, 0.7);
    col += coreColor * coreGlow * 0.8; // Reduced
    
    col += stars(uv, t);
    
    float dust = noise(uv * 50.0 + t * 0.5);
    dust = pow(dust, 3.0) * 0.2; // Reduced
    col += vec3(dust);
    
    float vignette = 1.0 - dist * 0.35;
    col *= vignette;
    
    // No final boost - tone map only
    col = col / (1.0 + col * 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