A modular fractal generator built with Rust and Bevy. This README reflects the actual implementation status and serves as a living document that evolves with the code.
- โ Bevy 0.17 + bevy_egui integration for desktop GUI
- โ Core fractal engine with CPU-based distance estimation (Mandelbrot, Julia, Mandelbulb, Mandelbox, more)
- โ Basic viewport and parameter panels
- ๐ง GPU renderer integration (WGSL compute/render) in progress
- ๐ง Node system: data model implemented; editor UI not implemented yet
- ๐ง Export: placeholder mesh/image exporters (non-fractal meshes)
- ๐ง Animation: keyframe/timeline structures present; no timeline UI yet
- โ Advanced features (GI, volumes, VR/AR, gesture, NFT) not implemented
- Fractal mathematics and distance estimation in
src/fractal/engine.rs - Bevy-based GUI scaffolding in
src/gui.rswith viewport texture binding - Basic parameter handling, color palettes, and metrics
- GPU/WGPU setup with backend preflight and logging
- Viewport image binding for Camera3d โ egui texture
- Exporters stubbed (OBJ/STL/PLY ASCII basics)
- Visual node editor (drag-and-drop, connectors, groups)
- GPU compute path for fractal evaluation and shading
- Timeline editor, audio/MIDI integration
- Proper mesh extraction from DE fields and voxel formats
flowchart LR
A[GUI (Bevy + bevy_egui)] --> B[FractalStudioApp]
B --> C[Fractal Engine (CPU)]
B --> D[Renderer (GPU/WGPU) ~ in progress]
B --> E[Node System (data model)]
B --> F[Animation (structures)]
B --> G[Export (placeholders)]
C -->|DE results| D
E -->|Graphs/Params| C
F -->|Param drives| C
G -->|Images/Meshes| H[Disk]
- โ 2D: Mandelbrot, Julia, Burning Ship, Tricorn
- โ 3D: Mandelbulb, Mandelbox; distance estimators on CPU
- ๐ง Quaternion Julia, Kaleidoscopic IFS: basic math present
- โ Real-time parameter updates (iterations, bailout, palette, etc.)
- ๐ง Camera controls and lighting: minimal; PBR pipeline not wired
- โ
Data model:
Node,NodeGraph,NodeConnection,DataType - โ Generators/Math/Color/Transform/Output enums
- ๐ง Execution logic is simplified; editor UI missing
- โ See
docs/NODE_SYSTEM.mdfor details and roadmap
- โ Ray-marching math and DE routines on CPU
- ๐ง WGSL shaders and GPU path wiring
- ๐ง Adaptive quality and performance presets
- ๐ง ASCII OBJ/STL/PLY basics; placeholder cube export
- ๐ง Snapshot PNG pipeline (alpha)
- โ Desktop (Windows/macOS/Linux)
- โน๏ธ Web/WASM lives elsewhere; see
docs/PLATFORM_SPLIT.md
- 2D Fractals: Mandelbrot, Julia, Burning Ship, Tricorn, Phoenix
- 3D Fractals: Mandelbulb, Mandelbox, Menger Sponge, Quaternion Julia
- Hybrid Fractals: BulbBox, Amazing Box, Kaleidoscopic IFS
- Procedural: Generic spirals, torus, helix, vortex patterns
- Distance Estimation: GPU-accelerated real-time rendering
- Real-time Parameters: Zoom, iterations, power, bailout, rotation
- Color Control: Customizable palettes and gradient mapping
- Transform Controls: Position, scale, rotation, folding parameters
- Fractal-specific: Mandelbulb power, Mandelbox folding, IFS transforms
- Visual Node Editor: Drag-and-drop fractal composition
- Generator Nodes: 2D/3D fractals, noise, mathematical functions
- Transform Nodes: Position, scale, rotate, warp operations
- Effect Nodes: Color correction, geometry transforms, filters
- Animation Nodes: Timeline control, LFO oscillators, noise generators
- GPU Acceleration: WebGPU/Vulkan/Metal/DX12 support
- Real-time Rendering: 60+ FPS on modern GPUs
- Cross-Platform: Windows, macOS, Linux (desktop-only)
- Memory Efficient: Optimized resource management
- Keyframe Animation: Professional timeline with interpolation
- Procedural Animation: L-systems, noise, attractors
- Camera Animation: Cinematic camera movement
- Parameter Automation: Dynamic fractal parameter changes
- Ray Marching: Real-time distance field rendering
- Adaptive Quality: Automatic LOD based on performance
- Professional Viewport: 3D navigation and camera controls
- Material System: PBR materials with metallic/roughness workflow
- Multi-Display: Support for complex display setups
- Viewport Controls: Professional camera and navigation tools
- Interactive Controls: Real-time parameter adjustment
- Export Preview: WYSIWYG export preparation
- Dark Theme: Modern dark interface with glassmorphism
- Customizable Workspaces: Multiple layout configurations
- Context Menus: Right-click context-sensitive actions
- Keyboard Shortcuts: Efficient workflow optimization
- Rust 1.70+
- Vulkan/Metal/DX12 compatible GPU
- Audio device (optional, for audio features)
- MIDI device (optional, for MIDI control)
git clone https://github.com/compiling-org/modular-fractal-shader
cd modular-fractal-shader
cargo build --releasedocs/FEATURES_STATUS.mdโ Implemented vs partial vs planned (living)docs/NODE_SYSTEM.mdโ Node system design, status, diagramsdocs/DEVELOPMENT_PLAN.mdโ Phases, goals, acceptance criteriadocs/DEVELOPMENT_ROADMAP.mdโ Milestones and prioritiesdocs/DOCS_MAINTENANCE.mdโ Update cadence and protocols
Documents are living and updated alongside code changes.
- Prefer discrete GPU; logs diagnostics and continues if unavailable
- Backend preflight sets
WGPU_BACKENDand compiler hints on Windows - Recommended environment configuration before running:
- Windows:
WGPU_BACKEND=vulkan,dx12,WGPU_POWER_PREF=high,WGPU_DX12_COMPILER=fxc - macOS:
WGPU_BACKEND=metal,WGPU_POWER_PREF=high - Linux:
WGPU_BACKEND=vulkan,WGPU_POWER_PREF=high
- Windows:
- See
gpu_startup.logafter launch for adapter diagnostics
- PowerShell (Windows):
$env:WGPU_BACKEND = 'vulkan,dx12'
$env:WGPU_POWER_PREF = 'high'
$env:WGPU_DX12_COMPILER = 'fxc'
cargo run --features gui
- Git Bash (Windows):
export WGPU_BACKEND='vulkan,dx12'
export WGPU_POWER_PREF='high'
export WGPU_DX12_COMPILER='fxc'
cargo run --features gui
- macOS/Linux:
export WGPU_BACKEND='metal' # macOS
export WGPU_BACKEND='vulkan' # Linux
export WGPU_POWER_PREF='high'
cargo run --features gui
If the app exits with a message about โGPU device not available โ GPU-only policy enforced,โ verify drivers and backend selection.
- Update relevant docs in the same PR as code changes
- Use status tags: Implemented / Partial / Planned
- Keep
docs/FEATURES_STATUS.mdanddocs/NODE_SYSTEM.mdcurrent
Track Current Issues:
- Known problems and planned fixes live in
docs/ISSUES_TRACKER.md. - When you discover a new issue or change an issueโs status, update the tracker in the same PR.
- Keep repro steps and acceptance criteria precise; this makes triage and validation fast.
# Start GUI application
cargo run
# Run performance benchmarks
cargo run -- benchmark
# Run compatibility tests
cargo run -- testThe fragment path is exploratory and not wired to production UI. Expect limited functionality.
- Modes: off, grayscale by depth, multiply base
- Parameters exist; UI and shader wiring are evolving
cargo run --example node_editor_democargo run --example fractal_demo# Export a placeholder OBJ mesh (cube) to exports/mesh.obj
cargo run --bin mesh_export -- --output exports/mesh.obj --width 32 --height 32 --depth 32- Current behavior exports a placeholder cube (non-fractal)
- Intended roadmap: load a
.fractproject, evaluate scene objects, and export meshes per object parameters. - Flags:
--output <path>,--width <w>,--height <h>,--depth <d>(defaults:exports/mesh.obj,32,32,32).
Render a single PNG using the CPU path; WGSL integration is in progress.
# Default snapshot (1024x768, Mandelbulb)
cargo run --bin fractal-snapshot
# Snapshot with camera, lighting, DEโcolor, and tonemapping controls
cargo run --bin fractal-snapshot -- '{
"width": 1024,
"height": 768,
"formula": "mandelbulb",
"camera_fov": 60.0,
"light_direction": [0.4, 0.7, -0.2],
"light_color": [0.8, 0.9, 1.0],
"light_intensity": 1.0,
"material_metallic": 0.0,
"material_roughness": 0.5,
"de_color_mode": 1,
"de_color_scale": 0.2,
"tonemap": "reinhard",
"exposure": 1.2,
"output": "snapshot.png"
}'- DEโcolor:
de_color_mode(0off,1grayscale by depth,2multiply base),de_color_scale(depth scale). - Tonemapping:
tonemap(none|reinhard),exposure(positive float). - Camera & lighting:
camera_fov(degrees),light_direction(xyz),light_color(rgb),light_intensity,material_metallic,material_roughness.
Desktop-only in this repository. Web/WASM builds live in NUWE; see docs/PLATFORM_SPLIT.md.
- The browser/WASM edition lives in the NUWE blockchain project.
- This repo focuses on native desktop builds; web API/UI code is relocated.
- For details and links to the web codebase, see
docs/PLATFORM_SPLIT.md.
FractalEngineโ CPU DE math and coloringRendererโ WGSL shaders and GPU wiring (in progress)Nodesโ Data model and execution stubsAnimationโ Keyframe/timeline structuresSceneโ Cameras and basic 3D setupExportโ ASCII mesh/image placeholders
classDiagram
class FractalEngine {
+compute_distance(vec3) DistanceResult
+parameters : FractalParameters
}
class Renderer {
+initialize_wgpu(device, queue)
+fractal_compute.wgsl
}
class NodeGraph {
+nodes : HashMap
+connections : Vec
+execute(context) NodeResult
}
FractalEngine <.. Renderer
NodeGraph --> FractalEngine
- Generators: Mandelbrot, Julia, Mandelbulb, Mandelbox, IFS (data model)
- Math: Add, Multiply, Sine, Cosine, Absolute, etc.
- Color: Invert, Brightness (basic)
- Transform: Scale (basic)
- Output: Pass-through
See docs/NODE_SYSTEM.md for full details and planned nodes.
# Debug build
cargo build
# Release build (optimized)
cargo build --release
# Run tests
cargo test
# Run examples
cargo run --example node_editor_demo
cargo run --example fractal_demosrc/
โโโ main.rs # Application entry point
โโโ lib.rs # Library interface
โโโ gui.rs # Bevy GUI implementation
โโโ fractal/ # Fractal engine
โ โโโ mod.rs
โ โโโ engine.rs
โ โโโ formulas.rs
โ โโโ renderer.rs
โ โโโ types.rs
โโโ ui/ # User interface
โ โโโ mod.rs
โ โโโ main.rs
โ โโโ node_editor.rs
โ โโโ theme.rs
โ โโโ fractal_ui.rs
โโโ scene/ # 3D scene management
โ โโโ mod.rs
โโโ animation/ # Animation system
โ โโโ mod.rs
โ โโโ timeline.rs
โ โโโ keyframe.rs
โโโ export/ # Export functionality
โ โโโ mod.rs
โโโ benchmark.rs # Performance benchmarking
โโโ project.rs # Project management
โโโ nodes.rs # Node definitions
docs/ # Documentation
examples/ # Example applications
assets/ # Shaders and resources
- Foundation: GPU renderer, node editor UI, mesh export from DE
- Core: timeline editor, audio/MIDI, camera+lighting controls
- Advanced: volumes, GI, VR/AR, collaboration, plugins
Contributions are welcome! Please feel free to submit a Pull Request.
- Follow Rust coding standards
- Add tests for new features
- Update documentation
- Ensure cross-platform compatibility
- All code changes must be paired with documentation updates.
- CI includes a Docs Gate that fails PRs with code changes unless
docs/files are updated. - PRs must link updated docs and acceptance criteria (see
.github/PULL_REQUEST_TEMPLATE.md). - Commit messages should include a
Docs:section or links to updated docs. UseDoc-Exemptonly for trivial infra/typo commits.
- Install local hooks to enforce docs-first commits:
- PowerShell:
powershell -ExecutionPolicy Bypass -File scripts/install_hooks.ps1 - Or:
pwsh -File scripts/install_hooks.ps1
- PowerShell:
- Hooks installed:
pre-commit(blocks code-only commits),commit-msg(nudges to include docs context).
- At least one of:
docs/DEVELOPMENT_PLAN.mddocs/DEVELOPMENT_ROADMAP.mddocs/GAP_ASSESSMENT.md- Relevant module plans (e.g.,
docs/VR_XR_INTEGRATION_PLAN.md,docs/GESTURE_INPUT_PLAN.md)
- Reference:
docs/DOCS_MAINTENANCE.mdโ Living Docs Protocol and automation.
This project is licensed under the MIT License - see the LICENSE file for details.
- Bevy Engine - For the amazing Rust game engine
- WebGPU/WGSL - For modern GPU compute capabilities
- Rust Community - For the excellent ecosystem
- Fractal Community - For the inspiration and algorithms
- Repository: GitHub
- Issues: GitHub Issues
- Discussions: GitHub Discussions
Made with โค๏ธ and lots of fractals
- The project is desktop-focused; no server or web preview is required.
- See
docs/THEME_CONTROLS.mdfor usage and implementation details.