Lesson 10 of 10 · Fractals in GLSL
Vivid
All of it: palette, edge glow, veins and vignette. Your piece.
The finale stacks everything you learned in one pass: smooth count for the base color, an edge glow on frags that took long to escape, the orbit-trap veins inside, a slow breath with T, and a vignette that seats the piece in its frame.
No new technique. Just all of them together, calibrated. That is composition: layers that add up without fighting.
Layers
band = color from the smooth count. edge = warm glow where the edge runs deepest. vein = the orbit trap lighting the interior. vig = darkens the corners. Adding lights (not multiplying) keeps the colors clean.Raise
band=sn * 0.5 to 1.0 for more color rings, or drop zoom to 0.7 to step into detail. Tune the vignette by changing the 0.16 in dot(uv,uv)*0.16.The code
precision highp float;
void main(){
vec2 uv=(gl_FragCoord.xy*2.0 - R)/R.y;
float zoom=1.3 + sin(T*0.22)*0.055;
vec2 orbit=vec2(cos(T*0.11),sin(T*0.13))*0.018;
vec2 c=uv*zoom+vec2(-0.6,0.0)+orbit;
vec2 z=vec2(0.0);
float n=0.0; bool esc=false; float trap=1000.0;
const int IT=160;
for(int i=0;i<IT;i++){
z=vec2(z.x*z.x-z.y*z.y, 2.0*z.x*z.y)+c;
trap=min(trap, abs(length(z)-1.0));
if(dot(z,z)>256.0){ n=float(i); esc=true; break; }
}
float sn=esc ? (n - log2(log2(dot(z,z))) + 4.0) : 0.0;
float band=sn * 0.5;
vec3 col=0.5+0.5*cos(0.35*band + vec3(0.0,0.6,1.1) + T*0.15);
float edge=esc ? smoothstep(0.2, 0.6, sn/float(IT)) : 0.0;
col+=vec3(1.0,0.85,0.6)*edge*0.5;
float vein=pow(clamp(1.0-trap*1.2,0.0,1.0),3.0);
col+=vec3(0.6,0.85,1.0)*vein*0.6;
col=esc ? col : (vec3(0.02,0.0,0.05)+vec3(0.6,0.85,1.0)*vein*0.6);
float vig=1.0-dot(uv,uv)*0.16;
col*=vig;
gl_FragColor=vec4(col,1.0);
}