Stellar Windows (with color)

GLSL shader by Sheaf · created 2026-03-14 · 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

precision highp float;
const float PI = 3.141592653589793;

#define cmul(a,b)   ( mat2((a).x, -(a).y, (a).y, (a).x) * (b) )
#define conj(a)     vec2((a).x, -(a).y)
#define cinv(a)     ( conj(a) / max(dot(a, a), 1e-12) )
#define cdiv(a,b)   ( cmul(a, cinv(b)) )
#define cexp(a)     ( exp((a).x) * vec2(cos((a).y), sin((a).y)) )
#define clog(a)     vec2(log(max(length(a), 1e-12)), atan((a).y, (a).x))
#define cpow(a,n)   cexp(float(n) * clog(a))

vec3 hsv2rgb(float h, float s, float v)
{
    float c = s;
    float h2 = h / 60.0;
    float x  = c * (1.0 - abs(mod(h2, 2.0) - 1.0));
    vec3 rgb = (v - c) * vec3(1.0);

    if (h2 < 1.0)      rgb += vec3(c, x, 0.0);
    else if (h2 < 2.0) rgb += vec3(x, c, 0.0);
    else if (h2 < 3.0) rgb += vec3(0.0, c, x);
    else if (h2 < 4.0) rgb += vec3(0.0, x, c);
    else if (h2 < 5.0) rgb += vec3(x, 0.0, c);
    else               rgb += vec3(c, 0.0, x);

    return rgb;
}

void mainImage(out vec4 O, in vec2 u)
{
    vec2 res = iResolution.xy;
    vec2 uv = (u * 2.0 - res) / min(res.x, res.y);

    float t = iTime;
    uv *= 1.1;

    vec2 a = vec2(sin(t), cos(t));
    vec2 b = vec2(1.0, 0.0);
    vec2 c = vec2(0.0, 1.0);
    vec2 d = vec2(1.0, 0.0);
    vec2 e = vec2(sin(t * 0.83), cos(t * 0.83));

    vec2 f = cpow(uv, 100)
           + cmul(a, cpow(uv, 4))
           + cmul(b, cpow(uv, 3))
           + cmul(c, cpow(uv, 2))
           + cmul(d, uv)
           + e;

    float theta = (atan(f.x, f.y) + PI) / (2.0 * PI) * 360.0;
    float r = length(f);

    O = vec4(hsv2rgb(theta, 0.1 / r, 0.3 / r), 1.0);
}

Buffer A (iChannel0)

precision highp float;
const float PI = 3.141592653589793;

#define cmul(a,b)   ( mat2((a).x, -(a).y, (a).y, (a).x) * (b) )
#define conj(a)     vec2((a).x, -(a).y)
#define cinv(a)     ( conj(a) / max(dot(a, a), 1e-12) )
#define cdiv(a,b)   ( cmul(a, cinv(b)) )
#define cexp(a)     ( exp((a).x) * vec2(cos((a).y), sin((a).y)) )
#define clog(a)     vec2(log(max(length(a), 1e-12)), atan((a).y, (a).x))
#define cpow(a,n)   cexp(float(n) * clog(a))

vec3 hsv2rgb(float h, float s, float v)
{
    float c = s;
    float h2 = h / 60.0;
    float x  = c * (1.0 - abs(mod(h2, 2.0) - 1.0));
    vec3 rgb = (v - c) * vec3(1.0);

    if (h2 < 1.0)      rgb += vec3(c, x, 0.0);
    else if (h2 < 2.0) rgb += vec3(x, c, 0.0);
    else if (h2 < 3.0) rgb += vec3(0.0, c, x);
    else if (h2 < 4.0) rgb += vec3(0.0, x, c);
    else if (h2 < 5.0) rgb += vec3(x, 0.0, c);
    else               rgb += vec3(c, 0.0, x);

    return rgb;
}

void mainImage(out vec4 O, in vec2 u)
{
    vec2 res = iResolution.xy;
    vec2 uv = (u * 2.0 - res) / min(res.x, res.y);

    float t = iTime;
    uv *= 1.1;

    vec2 a = vec2(sin(t), cos(t));
    vec2 b = vec2(1.0, 0.0);
    vec2 c = vec2(0.0, 1.0);
    vec2 d = vec2(1.0, 0.0);
    vec2 e = vec2(sin(t * 0.83), cos(t * 0.83));

    vec2 f = cpow(uv, 100)
           + cmul(a, cpow(uv, 4))
           + cmul(b, cpow(uv, 3))
           + cmul(c, cpow(uv, 2))
           + cmul(d, uv)
           + e;

    float theta = (atan(f.x, f.y) + PI) / (2.0 * PI) * 360.0;
    float r = length(f);

    O = vec4(hsv2rgb(theta, 0.1 / r, 0.3 / r), 1.0);
}

Image

Not used

More shaders by Sheaf

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

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

Account

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