MegaFractal

A minimal C++ + OpenCL renderer for Ultra Fractal .upr parameter files.

What it does

Gallery

Pre-rendered with mf -sl 6 on an RTX 4090. UPRs ship in tests/UF_params/.

Quick start

git clone https://github.com/your-org/MegaFractal && cd MegaFractal
cmake -S . -B build -DCMAKE_BUILD_TYPE=Release
cmake --build build -j

build/mf tests/UF_params/basic_mb/basic_mb.upr out.png -sl 4
build/mf_gui                # interactive preview

Formula cache

Most demo scenes pull in third-party formulas from the public UF formula database plus UF’s bundled Standard.{ucl,ufm,uxf}. Run one of these once to populate UF_formulas/:

python scripts/fetch_formulas.py                                    # any OS
powershell -ExecutionPolicy Bypass -File scripts\fetch_formulas.ps1 # Windows, no Python

Both copy the bundled Standard stubs that ship in scripts/standard_stub/ and download ~77 third-party files. Pass --force (or -Force) to overwrite. The Windows distribution zip ships both scripts.

Animation

UPRs can store keyframe chains. MegaFractal interpolates and renders any frame:

build/mf scene.upr out.png -frame 30
build/mf scene.upr out.png --frames 1:240
ffmpeg -framerate 30 -i out_%04d.png -pix_fmt yuv420p out.mp4

Architecture

Six files do everything. parser.cpp reads UPRs and resolves external formula references. translator.cpp turns UF formulas into OpenCL C with two-pass type inference. kernel_gen.cpp assembles a complete scene kernel — per-AA-sample compositor, 18 blend modes, gradient LUT, imaging kernel. renderer.cpp picks a device, probes for a TDR-safe tile size, and drives progressive accumulation. anim.cpp evaluates animation keyframes. main.cpp wires it together.

Credits

The test corpus is adapted from baeldin/uf2opencl.