Hard EffectsAnimated

Kaleidoscope

Fold space into 8 mirrored wedges and fill them with shifting color.

The target picture for the shader challenge "Kaleidoscope"
Recreate this picture. You pass at a 99% match, then try to write it in fewer characters than the par.

How this challenge works

You write a fragment shader that draws the picture above, live in your browser. A match bar shows how close you are, and the score combines accuracy, code size (the par is 379 characters in Unity (Built-in)) and GPU speed. Work in HLSL, GLSL, WGSL, Metal or Godot and export the result when you are done.

The numbers you need

Polar
r = length(p), a = atan2(p.y, p.x)
Fold
seg = 6.28318 / 8.0; a = abs(fmod(a + 6.28318, seg) - seg * 0.5) (+ 6.28318 keeps the angle positive)
Rebuild
q = r * float2(cos(a), sin(a))
Color
0.5 + 0.5 * cos(float3(0.0, 2.0, 4.0) + q.x * 14.0 + q.y * 9.0 + time)
Round mask
col *= 1.0 - smoothstep(0.45, 0.6, r)

Solve it in your language

Unity (Built-in), Unity (URP), Unreal, Shadertoy / WebGL, OpenGL (LWJGL, raylib), three.js, GameMaker, LÖVE (Lua), Godot, Apple (iOS, macOS), WebGPU / Bevy.

Start coding