Hard RaymarchAnimated

Fractal: Mandelbulb

A slowly turning 3D fractal, shaded by how many iterations it took to escape.

The target picture for the shader challenge "Fractal: Mandelbulb"
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 952 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

Distance estimator
power 8: iterate z = zr^8 (spherical coordinates) + p for 6 iterations, tracking dr = pow(r, 7.0) * 8.0 * dr + 1.0; return 0.5 * log(r) * r / dr (use the Toolbox-free hint formula)
Spin
rotate p around Y by time * 0.3 first
Camera
ro = float3(0.0, 0.0, -2.6), rd = normalize(float3(p, 1.6))
March
80 steps, hit d < 0.002, miss t > 6
Color
cheap AO from step count: 1.0 - float(steps) / 80.0, tinted lerp(float3(0.1,0.2,0.4), float3(1.0,0.7,0.4), that)
Background
float3(0.02, 0.02, 0.05)

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