A real-time ray tracer implemented in Python and CUDA that combines physically-based rendering with an audio-reactive birds flocking simulation - using the Boids algorithm.
Note: This is my tiny tribute to one of my favourite songs - Flume (fav artist) X Greenpeace (environmental activism network)
- CUDA kernel for ray-sphere intersection and shading calculations
- Lighting with ambient, diffuse, and specular shading
- Soft shadows and reflective surfaces
- Real-time perf through GPU acceleration
- Shitty Aim Trainer using PyGame for ui and coloring the pixels.
- Implementation of Craig Reynolds' Boids flocking algorithm
- 256 concurrent bird agents rendered as reflective spheres
- Real-time audio reactivity:
- Flock behavior modulated by frequency analysis
- Movement parameters controlled by beat detection
- Visual properties (color, size, reflectivity) respond to audio features
- First-person camera controls (WASD + mouse)
- Real-time spectator mode to observe the flock
- Dynamic adjustment of simulation parameters
- Significant speedup achieved through CUDA acceleration (1000x if my calulations are right)
- Comparative benchmarks between:
- Raw Python implementation
- Numba JIT compilation
- CUDA parallel processing
- Real-time performance monitoring and visualization
- Custom CUDA kernels for core rendering ops
- Real-time FFT analysis for frequency separation
- Onset detection for beat recognition
- Multi-band audio feature extraction
- Python 3.8+
- NVIDIA GPU with CUDA support
- Poetry for dependency management
# Clone the repository
git clone https://github.com/floaredor/cuda-raytracer.git
cd cuda-raytracer
# Install dependencies
poetry install
# Run with default audio file
python experiments/music_boids.py
# Run with custom audio file
python experiments/music_boids.py path/to/your/audio.wav
W/A/S/D
- Move cameraMouse
- Look aroundESC
- Exit and generate performance plots
- Multiple light sources
- Anti-aliasing
- More complex geometries
- UI for parameter adjustment like ImGUI
This project was developed as a practical exploration of NVIDIA's CUDA Python course concepts. It shows the application of parallel processing techniques to graphics and nature-based simulation while incorporating real-time audio processing for an interactive experience.
MIT
- NVIDIA for their CUDA Python course
- Craig Reynolds for the original Boids algorithm