Skip to content

jamescorbett/fractal

Repository files navigation

Fractal Flame Renderer

A high-performance fractal flame rendering engine with both web (WebGPU) and CLI (Node.js) interfaces

Live Demo

Screenshot

Why

Fractal flames are interesting as they represent the intersection of art and compute. Originally powered by Apophysis running on CPU flames took a really long time to make and even low resolution video was basically unherd of. Fractron9000 represented a shift where a GPU could be used to produce flames but feature parity with Apophysis never occured and it stopped being easy to compile and run on windows a long time ago. I've tried various methods of doing flames at some scale in the past, such as hosting Fractron9000 on a server back in 2014, but issues with mono and gpus prevented me moving forwards.

Since then I've used it as a test for AI agents as a good opensource task to test the limits of pair programming with agents. Porting OpenCL to WebGPU compute shaders is not simple, and I had to use a combonation with GPT-5.2 and Opus to get the initial version across the line.

Now the framework is here adding more features is easy and this version includes video capability with keyframes and auto tweening.

Architecture Overview

This is a monorepo containing three packages:

fractal/
├── packages/
│   ├── core/          # @fractal/core - Shared engine library
│   ├── web/           # @fractal/web - WebGPU web interface (Vite + React)
│   └── cli/           # @fractal/cli - Node.js CLI with @kmamal/gpu
├── presets/           # Shared fractal preset files (.json format)
└── scripts/           # Build and conversion scripts

Packages

@fractal/core

Platform-agnostic fractal flame engine library:

  • Abstract FractalEngineBase class
  • File format parser (FractalFileFormat) with JSON schema validation
  • Mathematical utilities (Affine2D transforms, 30 variations)
  • Shared type definitions
  • WGSL shader source code

@fractal/web

Interactive web interface using React + Vite + WebGPU:

  • Real-time fractal rendering with WebGPU compute shaders
  • Interactive parameter editing
  • Preset library browser
  • Transform overlay for visual editing
  • PNG export

@fractal/cli

Command-line interface for validation and information:

Getting Started

Prerequisites

  • Node.js 18+
  • pnpm (recommended)

Installation

# Install pnpm if needed
npm install -g pnpm

# Install all dependencies
pnpm install

# Build all packages
pnpm run build

Running the Web Interface

# Start development server
pnpm run dev:web

Open http://localhost:5173 in a WebGPU-enabled browser (Chrome 113+, Edge 113+).

Using the CLI

# Validate a preset file
pnpm run cli -- validate presets/sierpinski.json

# Show preset information
pnpm run cli -- info presets/sierpinski.json

# List all variations
pnpm run cli -- variations

# Show help
pnpm run cli -- --help

Acknowledgments

Uses the Fractal Flame Algorithm by Scott Draves and Erik Reckase.

Inspiration and color palettes were taken from Apophysis.

Fratron9000 for original OpenCL version and for many hours of fun.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors