โโโโ โโโโโโโโโโโ โโโโโโโโโโโโโ โโโโโโโโโ
โโโโโ โโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโโโโ
โโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโ โโโ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โโโ
โโโ โโโ โโโโโโโโโ โโโโโโโโโโโโ โโโ โโโ
โโโ โโโโโโโโโ โโโโโโโโโโโ โโโ โโโ
Render photorealistic images across multiple machines with multi-threading, BVH acceleration, and real-time camera control
๐ Quick Start โข โจ Features โข ๐ธ Gallery โข ๐ Documentation
Lambertian, Metal, and Glass materials with realistic light interactions
Spheres, planes, cylinders and cones
Rendering 100K objects at interactive framerates
Triangle-based mesh rendering with material support
Get rendering in 60 seconds:
# One-line installation
bash <(curl -L https://raw.githubusercontent.com/4n4k1n/42-miniRT/refs/heads/master/setup.sh)
# Build
make
# Run a demo scene
./miniRT scenes/demo.rt# Terminal 1 - Master Node
./miniRT --master scenes/solar_system.rt --port 9000
# Terminal 2 - Worker Node (same or different machine)
./miniRT --worker 192.168.1.100 --port 9000That's it! Press ENTER in the master terminal and watch your scene render across multiple machines.
|
|
|
|
| ๐ Traditional Ray Tracer | โก miniRT |
|---|---|
| Single-threaded | Multi-threaded (all cores) |
| O(n) intersection tests | O(log n) with BVH |
| Single machine only | Distributed across network |
| Static camera | Real-time camera control |
| Minutes per frame | Interactive framerates |
Scene with 10,000 spheres at 1920x1080:
Without BVH: 0.01 FPS (100 seconds per frame) ๐
With BVH: 5.00 FPS (0.2 seconds per frame) โก
Speedup: 500x faster!
Scene rendered across 8 worker machines:
1 Worker: 60 seconds (baseline)
2 Workers: 32 seconds (1.88x faster)
4 Workers: 17 seconds (3.53x faster)
8 Workers: 9 seconds (6.67x faster)
Near-linear scaling!
|
Lambertian (Matte) Perfect diffuse surfaces Metal (Reflective) Specular reflection Glass (Dielectric) Refraction + reflection (IOR: 1.5) Checker Texture Procedural checker pattern Bump Mapping Surface detail from image |
| ๐ฏ Action | โจ๏ธ Key | ๐ฏ Action | โจ๏ธ Key |
|---|---|---|---|
| Move Forward | W |
Move Up | Space |
| Move Backward | S |
Move Down | Shift |
| Move Left | A |
Look Up | โ |
| Move Right | D |
Look Down | โ |
| Look Left | โ |
Look Right | โ |
| Toggle Anti-Aliasing | R |
Toggle Lighting | L |
| Exit | ESC |
- | - |
Create stunning scenes with our simple text format:
# Ambient lighting (intensity R,G,B)
A 0.15 255,255,255
# Camera (position orientation FOV)
C 0,1,5 0,0,0.5 70
# Light source (position brightness [R,G,B optional])
L -5,8,3 0.8
# Sphere (center diameter R,G,B [material] [texture/bump])
sp 0,0,-1 1.2 255,255,255 L tx:checker:12
# Sphere with bump mapping
sp 3,0,-1 1.2 50,205,50 bm:assets/earth.png:1.8
# Glass/dielectric sphere
sp 0,3,-1.8 0.4 240,230,140 G:1.5
# Metal sphere
sp -3,0,-1 1.2 255,255,255 M
# Plane (point normal R,G,B [material])
pl -1,1,-40 0,0,1 200,200,255
# Cylinder (center axis diameter height R,G,B [material])
cy 3,4.5,11.5 1,1,0 0.7 7 139,69,19
# Cone (base_center axis diameter height R,G,B)
co 0,-3,12 0.23,1,0 3.1 11 205,133,63
Material Options:
L- Lambertian (diffuse/matte)M- Metal (reflective)G:index- Glass/dielectric (e.g.,G:1.5)tx:checker:scale- Checker texturebm:path:scale- Bump mapping from image
Check out scenes/ for 15+ example scenes including:
- ๐ช
solar_system.rt- Planetary configurations - ๐
material_showcase.rt- All material types - ๐ฅ
10000_spheres.rt- BVH stress test - ๐ง
ice.rt- Ice cream cone scene
|
๐ง Linux sudo apt-get install \
build-essential \
cmake \
libglfw3-dev |
๐ macOS # Install Homebrew first
brew install \
cmake \
glfw |
๐ฆ Build git clone [repo]
cd miniRT
make |
miniRT uses a sophisticated multi-mode architecture:
โโโโโโโโโโโโโโโโโโโ
โ Command Line โ
โโโโโโโโโโฌโโโโโโโโโ
โ
โโโโโโโโโโโโโโผโโโโโโโโโโโโโ
โ โ โ
โโโโโโโโผโโโโโโโ โโโโผโโโโโโโ โโโโผโโโโโโโโโ
โ Local Mode โ โ Master โ โ Worker โ
โ (Solo) โ โ Mode โ โ Mode โ
โโโโโโโโฌโโโโโโโ โโโโฌโโโโโโโ โโโโฌโโโโโโโโโ
โ โ โ
โ โโโโโโผโโโโโ โ
โ โ Network โโโโโโโโโ
โ โProtocol โ
โ โโโโโโโโโโโ
โ
โโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Multi-threaded Render Loop โ
โ โโโโโโโโโโโโฌโโโโโโโโโโโโโโโ โ
โ โ BVH โ Ray Tracing โ โ
โ โTraversal โ Pipeline โ โ
โ โโโโโโโโโโโโดโโโโโโโโโโโโโโโ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
- ๐ฏ Ray Tracing Pipeline - Recursive path tracing with material interaction
- ๐ BVH Acceleration - Hierarchical spatial indexing for fast intersection
- ๐งต Thread Pool - Work-stealing multi-threaded rendering
- ๐ Network Protocol - Custom binary protocol for distributed rendering
- ๐ฌ Real-time Updates - Camera changes broadcast instantly to all workers
๐ Detailed Architecture Documentation โ
| Metric | Count |
|---|---|
| Lines of Code | ~15,000 |
| Source Files | 80+ |
| Supported Primitives | 6 |
| Material Types | 3 (+bump mapping) |
| Example Scenes | 15+ |
| State Machine Diagrams | 10 |
| Network Message Types | 7 |
We welcome contributions! This is a 42 School project, but improvements are always appreciated.
# Fork, clone, and create a branch
git checkout -b feature/amazing-feature
# Make your changes and test
make re
./miniRT scenes/demo.rt
# Submit a pull requestGuidelines:
- Follow the 42 Norm
- Test with multiple scenes
- Update documentation
- Add state machine diagrams for architectural changes
- ๐ Code Documentation - Comprehensive developer guide
- ๐จ Scene Format Guide - Create custom scenes
- โก Performance Guide - Optimization tips
- ๐ง Troubleshooting - Common issues and solutions
๐ View State Machine Diagrams
- ๐ Ray Tracing in One Weekend - Peter Shirley
- ๐ Physically Based Rendering - PBRT Book
- ๐ Scratchapixel - Computer Graphics Tutorial
- ๐ฅ๏ธ MLX42 - Graphics Library
This project is licensed under the MIT License - see the LICENSE file for details.
๐ง Common Issues
MLX42 build fails:
git clone https://github.com/codam-coding-college/MLX42.git
cd MLX42
cmake -B build && cmake --build build -j4
cd .. && makeGLFW not found:
# Linux
sudo apt-get install libglfw3-dev
# macOS
brew install glfwSlow rendering:
- โ Enable BVH (enabled by default)
- โ Reduce anti-aliasing samples
- โ Lower resolution for testing
- โ Use distributed rendering
Worker can't connect:
- โ Check firewall settings
- โ
Verify IP address:
./miniRT --worker localhost --port 9000 - โ Ensure master is running first
Made with โค๏ธ at 42 School



