Skip to content

Latest commit

 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Mandelbulb — 3D Fractal Explorer

A real-time GPU ray-marched 3D fractal explorer written in Rust (wgpu + winit + egui), with a switchable voxel engine, progressive anti-aliasing, camera-path flythrough export, and high-resolution screenshot capture.

Classic power-8 Mandelbulb

Pseudo-Kleinian caves
Kleinian Dreams — pseudo-Kleinian caves, fly inside
Power-8 Julia bulb
Molten Julia Bulb — power-8 Julia set
Negative-scale Mandelbox
Negabox Reactor — Mandelbox at scale −1.75
Sierpinski tetrahedron
Sierpinski Spire — tetrahedral folding at sunset
Voxel engine mode
Voxel engine (V) — the same Mandelbulb baked into a 128³ grid and rendered as glowing cubes
cargo run --release

Renderer

  • Distance-estimated ray marching in a WGSL fragment shader: soft shadows, 5-tap ambient occlusion, palette-driven two-tone surface coloring (orbit traps), fresnel rim light, distance fog, step-count glow, optional one-bounce reflections.
  • Progressive anti-aliasing: while the camera is still, jittered samples are averaged into an HDR accumulation buffer — the image refines over time.
  • Post pass: exposure → ACES tonemap → vignette → film grain/dither.
  • Voxel engine (V): a compute shader bakes the current fractal into a packed occupancy grid (64³–384³, 4 cells per u32) over a few frames; a DDA traverser renders glowing cubes with face AO, voxel shadows, edge lines, and emissive cores.
  • The background (nebula, stars, sun) is derived from the active palette so every scene stays color-coherent.

Fractals

Mandelbulb (any power, plus Julia mode), Mandelbox (incl. negative scale), Menger Sponge, Sierpinski Tetrahedron, and Pseudo-Kleinian — with 9 tuned presets ("Classic Mandelbulb", "Molten Julia Bulb", "Mandelbox Citadel", "Kleinian Dreams", …).

Controls

Input Action
Right-mouse drag look around
W A S D / Q E fly / down / up
Shift 5× speed boost
Mouse wheel adjust fly speed
V toggle voxel engine
O auto-orbit demo mode (optional power morphing)
K drop a camera keyframe
Space play / stop the camera path
P / F12 high-res screenshot (up to 8K, supersampled) → ./screenshots
R reset camera to preset
Tab show / hide UI
F1 / H help overlay
Esc cancel export / stop playback / release mouse / quit

Fly speed automatically scales with the CPU-evaluated distance to the fractal surface, so you can dive arbitrarily deep into crevices without overshooting.

Flythrough export

Drop keyframes with K (Catmull-Rom interpolation, yaw unwrapping), set the duration, then Camera Path → Export frames. Frames render offscreen at up to 8K with N accumulation samples each and save as PNGs. Make a video with:

ffmpeg -framerate 30 -i flythrough/frame_%05d.png -pix_fmt yuv420p flight.mp4

Paths can be saved/loaded as camera_path.json.

Testing

cargo test                                      # headless shader validation + render smoke test
cargo test render_preset_previews -- --ignored  # renders every preset to target/previews/
cargo test render_readme_shots -- --ignored     # re-renders the images in assets/

About

rust 3d fractal viewer

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages