GPU-accelerated ray tracer built with C++ using the Walnut application framework.
A high-performance ray tracing implementation built on the Walnut App Template, featuring real-time rendering capabilities with plans for CUDA GPU acceleration. This project implements physically-based ray tracing algorithms for rendering realistic 3D scenes with support for materials, lighting, and advanced rendering techniques.
- π¨ Ray Tracing Engine - Core ray tracing implementation with ray-sphere intersection
- πΌοΈ Walnut Framework - Modern C++ application framework for windowing and UI
- π§ Premake Build System - Cross-platform build configuration with Lua scripts
- π¦ Submodule Architecture - Walnut framework integrated as a Git submodule
- π― Material System - Support for different material types (metals, dielectrics)
- π CUDA GPU Acceleration - Move ray tracing computation to GPU for massive performance gains
- πΌοΈ Texture Loading - Support for texture mapping on surfaces
- π· Extended Shapes - Additional primitives (cylinders, boxes, triangles, etc.)
- π BVH Acceleration - Bounding Volume Hierarchy for faster ray-object intersection
- π¨ Advanced Materials - Glass, metals, dielectrics with proper refraction
- π Monte Carlo Path Tracing - Advanced global illumination techniques
- β‘ Performance Optimization - Profiling and optimization of critical paths
RayTracing/
βββ Walnut/ # Walnut framework (Git submodule)
β βββ ... # Application framework and windowing
βββ Halide/ # Halide integration (if used)
β βββ ... # Image processing library
βββ scripts/ # Build and setup scripts
β βββ Setup.bat # Windows setup script for Visual Studio
βββ WalnutApp/ # Main application directory
β βββ src/
β βββ WalnutApp.cpp # Main application entry point
βββ premake5.lua # Premake build configuration
βββ .gitignore # Git ignore rules
βββ LICENSE.txt # MIT License
βββ README.md # This file
- Visual Studio 2022 (Windows) or compatible C++ compiler
- Premake5 - Build system generator (Download)
- C++17 or later - Modern C++ standard required
- Git - For submodule management
- CUDA Toolkit 11.0+ - For GPU acceleration (Download)
- NVIDIA GPU with CUDA support - Required for CUDA features
-
Clone the repository:
git clone https://github.com/AakashR13/RayTracing.git cd RayTracing -
Initialize and update submodules:
git submodule update --init --recursive
This will download the Walnut framework and any other dependencies.
-
Generate Visual Studio solution:
scripts/Setup.bat
This runs Premake5 to generate the Visual Studio solution and project files.
-
Build the project:
- Open the generated
WalnutApp.sln(or similar) in Visual Studio 2022 - Select your desired configuration (Debug/Release)
- Build the solution (Ctrl+Shift+B) or press F5 to build and run
- Open the generated
If the setup script doesn't work, you can run Premake manually:
# Download premake5.exe and place it in your PATH or project root
premake5 vs2022After building, run the executable from Visual Studio or navigate to the output directory:
- Debug builds: Typically in
WalnutApp/bin/Debug-windows-x86_64/WalnutApp/ - Release builds: Typically in
WalnutApp/bin/Release-windows-x86_64/WalnutApp/
The main application code is located in WalnutApp/src/WalnutApp.cpp. This is where you can:
- Modify scene setup (objects, materials, lighting)
- Adjust rendering parameters
- Add new features to the ray tracer
- Integrate CUDA kernels for GPU acceleration
- Modify code in
WalnutApp/src/WalnutApp.cpp - Rebuild the project in Visual Studio
- Run to see changes
- Iterate on features and optimizations
π§ Active Development - In Progress
- Separating Walnut submodule
- Fixing refraction implementation
- Adding texture loading support
- Adding additional shapes
- Implementing CUDA GPU acceleration
- β Basic ray tracing setup with Walnut framework
- β Project structure initialized
- β Premake build system configured
- β Ray-sphere intersection implemented
- β Basic material system
- C++ (94.0%) - Core ray tracing engine and application logic
- Lua (4.8%) - Premake build scripts for cross-platform configuration
- Other (1.2%) - Configuration files, licenses, documentation
-
Ray Tracing Engine
- Ray generation and intersection tests
- Material calculations (diffuse, metal, dielectric)
- Lighting and shading
-
Walnut Framework
- Window management
- Input handling
- Rendering context
-
Build System
- Premake5 for project generation
- Cross-platform support (Windows, Linux, macOS)
- CPU Ray Tracing - Current implementation runs on CPU
- GPU Acceleration - CUDA integration planned for 10-100x speedup
- Optimization Targets - BVH, SIMD, multi-threading
- Ray Tracing in One Weekend - Excellent introduction to ray tracing
- Ray Tracing: The Next Week - Advanced techniques
- Ray Tracing: The Rest of Your Life - Monte Carlo methods
- Walnut Framework - Application framework
- Walnut App Template - Template this project is based on
- Premake - Build system generator
- CUDA Programming Guide - GPU programming
- Fix refraction bugs
- Separate Walnut submodule properly
- Basic texture loading
- CUDA GPU acceleration
- Additional shape primitives
- BVH acceleration structure
- Monte Carlo path tracing
- Advanced material system
- Real-time interactive rendering
- Scene file format support
MIT License - See LICENSE.txt for details.
This project is based on the Walnut App Template, which is also MIT licensed.
Author: AakashR13
Repository: https://github.com/AakashR13/RayTracing
Status: π§ Active Development