Copyright (c) 2025
This project is licensed under the Elastic License 2.0.
See the LICENSE file for details.
LumaSort Engine is a high-performance C++20 real-time visualizer that rearranges pixels from live video feeds, static images, or real-time drawings into a target image based on global luminance intensity. By combining a "Pixel Sorting" algorithm with Fluid Dynamics (Flow Fields), it creates a mesmerizing, fluid-like transition of pixels finding their new "home" based on brightness.
The engine features a complete GUI control panel with native file dialogs, real-time physics parameter tuning, and an interactive canvas with VIBGYOR color palette for drawing. Users can load source and target images, adjust particle behavior, and watch the transformation unfold with a single button click.
- Introduction
- Features
- How It Works
- Architecture
- Tech Stack
- Directory Structure
- Download & Run
- Build from Source
- Usage Guide
- Troubleshooting
- Known Limitations & Future Work
- License
- Multi-Input Support: Live Webcam, Static Images, or Interactive Drawing Canvas
- Native File Dialogs: OS-native file pickers for loading source and target images
- Interactive Canvas: Draw with VIBGYOR color palette, adjustable brush sizes, and eraser tool
- Transform Control: Start/Stop transformation with dedicated button - preview content before animating
- Adaptive Resolution: Automatically adjusts particle count based on source image resolution
- Responsive Viewport: Dynamic scaling on window resize with aspect ratio preservation
- Real-time Visualization: High-performance sorting at 60+ FPS
- Physics Parameter Tuning: Adjust particle speed, flow strength, and noise scale in real-time
- Fluid Dynamics: Pixels move organically using Flow Fields (Perlin/Simplex Noise)
- Custom Branding: Application icon in taskbar and Alt-Tab switcher
- Input Selection: Choose between Webcam, Image, or Canvas mode via the GUI dropdown
- Source Loading: Load images using native file dialogs or draw on the canvas
- Target Loading: Select a target image that defines the final shape/pattern
- Preview: View your source content as a stable image before transformation
- Transform: Click "Start Transform" to begin the particle animation
- Luminance Sorting: Each source pixel is matched to a target pixel of similar brightness
- Steering Forces: Particles feel a pull towards their sorted destination
- Flow Field: Background vector field adds organic turbulence to the motion
- Convergence: Particles gradually settle into the target shape, recreating the image
The engine follows a strict separation of concerns with a complete GUI layer for user interaction.
graph TD
subgraph Core
App["App Loop"]
Main["Main Entry"] --> App
end
subgraph "Sub-systems"
UI["GuiLayer (ImGui + NFD)"]
Gfx["Renderer (OpenGL)"]
Sorter["Sorter"]
Flow["FlowField"]
Input["Inputs (Webcam/Image/Canvas)"]
end
subgraph Dependencies
GLFW["GLFW Window"]
CV["OpenCV"]
GL["OpenGL Texture"]
NFD["Native File Dialog"]
end
App -->|Updates| Input
App -->|Updates| Sorter
App -->|Updates| Flow
App -->|Renders| Gfx
App -->|Renders| UI
Input -->|Frame Data| Sorter
Input -->|Drawing| GL
Sorter -->|Target Mappings| App
App -->|Particles| Gfx
Flow -->|Forces| App
UI -->|File Selection| NFD
UI -- Controls --> Sorter
UI -- Controls --> Gfx
UI -- Controls --> Input
UI -- Transform --> App
style App fill:#f9f,stroke:#333,color:#000
style Sorter fill:#9cf,stroke:#333,color:#000
style Gfx fill:#9f9,stroke:#333,color:#000
style Flow fill:#c9f,stroke:#333,color:#000
style UI fill:#ff9,stroke:#333,color:#000
| Component | Technology | Reasoning |
|---|---|---|
| Language | C++20 | High-performance memory management and modern language features. |
| Build System | CMake | Industry standard for cross-platform C++ build configuration. |
| Package Manager | vcpkg | Seamless integration of libraries in "Manifest Mode" for reproducible builds. |
| Computer Vision | OpenCV 4 | Robust library for webcam feeds and efficient image matrix manipulation. |
| Rendering | OpenGL 3.3+ | Hardware acceleration for rendering millions of particles at 60 FPS. |
| Windowing | GLFW + GLAD | Lightweight, standard way to create contexts and handle input. |
| UI | Dear ImGui | Immediate Mode GUI for real-time parameter tuning and controls. |
| File Dialogs | NFD Extended | Cross-platform native file dialogs for OS-integrated file selection. |
| Math | GLM | Standard mathematics library for graphics (vectors, matrices, noise). |
lumasort-engine/
├── vcpkg.json # Dependency Manifest (OpenCV, ImGui, NFD, etc.)
├── CMakeLists.txt # Build Configuration
├── LumaSort.desktop # Linux Desktop Entry (for app launchers)
├── src/
│ ├── main.cpp # Entry Point
│ ├── app.h/cpp # Application Loop, State, & Transform Logic
│ ├── core/
│ │ ├── sorter.h/cpp # Luminance-based Pixel Sorting Algorithm
│ │ ├── particle.h # Particle Entity Structure
│ │ └── flow_field.h/cpp# Fluid Math (Perlin/Simplex Noise)
│ ├── graphics/
│ │ ├── renderer.h/cpp # OpenGL Particle Rendering
│ │ ├── texture.h/cpp # Texture Management & OpenCV Upload
│ │ └── canvas.h/cpp # FBO Drawing Surface with Color Support
│ └── ui/
│ └── gui_layer.h/cpp # ImGui Control Panel & Native File Dialogs
├── assets/
│ ├── icons/ # Application Icons
│ ├── shaders/ # GLSL Vertex & Fragment Shaders
│ └── images/ # Sample Images
└── build/ # (Generated) Build artifacts
Pre-built releases are available for Windows and Linux. No compilation required!
Go to the Releases Page and download the latest version for your OS.
- Download
LumaSort-windows-x64.zip - Extract the ZIP file
- Double-click
LumaSort.exeto run
- Download
LumaSort-linux-x86_64.tar.gz - Extract and run:
tar -xzvf LumaSort-linux-x86_64.tar.gz
cd LumaSort-linux
./run.shNote: The
run.shscript sets up the library paths automatically. Always use it to launch the application.
macOS pre-built binaries are not available in this release due to CI infrastructure limitations. macOS users can build from source - see Build from Source below.
Future Work: Native macOS builds (Intel and Apple Silicon) will be added when the vcpkg glad port is updated for CMake 4.x compatibility.
If you want to modify the code or build for a different platform, follow these instructions.
Essential Build Tools:
- C++ Compiler (GCC 11+ / Clang 14+)
- CMake (3.20+)
- Ninja or Make
System Libraries (Linux):
- X11 / OpenGL:
libx11-dev,libglu1-mesa-dev - GTK3 (for native file dialogs):
libgtk-3-dev - Build Helpers:
bison,flex,gperf,pkg-config - Python Build Environment:
python3-venv
sudo apt update && sudo apt install -y build-essential pkg-config cmake ninja-build autoconf autoconf-archive automake libtool bison flex gperf libx11-dev libxext-dev libxrandr-dev libxinerama-dev libxcursor-dev libxi-dev libglu1-mesa-dev libgl1-mesa-dev libgtk-3-dev python3-venv python3-jinja2-
Clone the Repository
git clone https://github.com/your-username/LumaSort-Engine.git cd LumaSort-Engine -
Configure (CMake + vcpkg)
cmake -B build -S . -DCMAKE_TOOLCHAIN_FILE=/path/to/vcpkg/scripts/buildsystems/vcpkg.cmake(Note: First build downloads and compiles all dependencies - may take 5-10 minutes)
-
Compile
cmake --build build
-
Run
./build/LumaSort
- Webcam: Live camera feed (adapts to webcam resolution, capped at 600px)
- Image: Load any image file - resolution adapts automatically (up to 800px)
- Canvas: Draw with VIBGYOR colors using pen/eraser tools
- Select input mode from the dropdown
- Load a Target Image using the native file dialog
- For Image mode: Load a Source Image
- For Canvas mode: Draw your design using the color palette
- Click Start Transform to begin the animation
- Adjust Physics Parameters (Speed, Flow Strength, Noise Scale) in real-time
- Click Stop Transform to reset and try again
| Parameter | Description | Range |
|---|---|---|
| Particle Speed | How fast particles move toward targets | 0.001 - 0.1 |
| Flow Strength | Intensity of turbulent flow field | 0.0001 - 0.01 |
| Noise Scale | Size of flow field patterns | 1.0 - 20.0 |
Fix: Install the missing python module:
sudo apt install python3-venvFix: Install build tool suite:
sudo apt install bison flex gperfCause: GTK3 development libraries are required for native file dialogs on Linux. Fix:
sudo apt install libgtk-3-devFix:
sudo apt install build-essential ninja-buildCause: Very large images (5000x3000+) generate hundreds of thousands of particles. Note: This is expected behavior - the engine caps at 800px for images to maintain performance.
Cause: Fixed point size rendering causes gaps between particles on certain GPU/resolution combinations. Status: Fixed in v1.0.1. If you see this issue, ensure you're running the latest version.
Why: GitHub Actions free tier macOS runners (macos-14/15) come with CMake 4.x, which is incompatible with the glad vcpkg port that uses deprecated CMake 3.0 syntax. Paid Intel runners would work but aren't available on the free tier.
Workaround: macOS users can build from source - the project builds successfully on macOS with Homebrew dependencies.
| Priority | Feature | Status |
|---|---|---|
| High | Native macOS builds (Intel + Apple Silicon) | Waiting for vcpkg glad fix |
| Medium | GPU-accelerated particle physics (compute shaders) | Planned |
| Medium | Video export functionality | Planned |
| Low | Custom flow field patterns | Planned |
This project is distributed under the Elastic License 2.0.
What this means:
- You can use, copy, distribute, make available, and prepare derivative works of the software.
- You may not provide the software to third parties as a hosted or managed service.
- You may not move, change, disable, or circumvent the license key functionality.
See LICENSE for the full legal text.