Stellar Window

GLSL shader by Sheaf · created 2026-03-06 · updated 2026-03-10 · 10s loop · 2 passes

Visualization of a complex polynomial of degree 100

Tags: Math, Complex, Polynomial

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)

precision highp float;

#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(length(a)), atan((a).y, (a).x) )
#define cpow(a,n)   cexp( float(n) * clog(a) )

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;
    float scale = 1.2;
    uv *= scale;

    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, cpow(uv, 1))
           + e;

    float p = length(f);

    O = vec4(vec3(0.2 / p), 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