Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

65 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

3D Ray Tracing Engine (Project CSI - Visual and Analytical Computing)

Cornell Water

A high-performance Monte Carlo Path Tracer with an interactive GUI, built from scratch in C++17. This project implements physically-based rendering (PBR) techniques including GGX microfacet materials, Bounding Volume Hierarchy (BVH) acceleration, and AI-powered denoising.

🎯 Features

Rendering

  • Monte Carlo Path Tracing with unbiased global illumination
  • Russian Roulette path termination for efficiency
  • Multiple Importance Sampling (MIS) with power heuristic
  • Next Event Estimation (NEE) for direct light sampling

Materials (PBR)

  • Lambertian diffuse surfaces
  • Metal with configurable roughness
  • Dielectric (glass/water) with Fresnel and refraction
  • GGX Microfacet for realistic metallic highlights
  • Emissive materials for area lights

Acceleration & Optimization

  • BVH (Bounding Volume Hierarchy) with Surface Area Heuristic
  • Multi-threaded tile-based rendering using C++ threads
  • Intel OIDN AI denoiser integration

Interactive GUI

  • Real-time progressive rendering
  • WASD + mouse camera controls
  • Live material and lighting adjustments
  • Scene file hot-reloading

οΏ½ Documentation

For a comprehensive technical documentation covering all algorithms, mathematical foundations, and implementation details, see:

πŸ“„ Project_Documentation.pdf - Complete 13-page technical report

The documentation includes:

  • Rendering equation and Monte Carlo integration theory
  • Ray-scene intersection algorithms (MΓΆller-Trumbore)
  • BVH construction with Surface Area Heuristic
  • Material models (Lambertian, GGX, Dielectric)
  • Importance sampling techniques (MIS, NEE, Russian Roulette)
  • System architecture and performance analysis

οΏ½πŸ› οΈ Tools & Technologies

Category Technology
Language C++17
Build System CMake 3.16+
GUI Dear ImGui + GLFW + OpenGL
Math GLM
Scene Format XML (tinyxml2) + OBJ/MTL
Denoising Intel Open Image Denoiser (OIDN)
Image I/O stb_image, stb_image_write

πŸ“‹ Prerequisites

Ensure you have the following installed:

  • CMake 3.16 or higher
  • C++17 compatible compiler (GCC 9+, Clang 10+, MSVC 2019+)
  • OpenGL 3.3+ compatible GPU and drivers
  • Git (for cloning)

macOS

brew install cmake glfw

Ubuntu/Debian

sudo apt update
sudo apt install cmake build-essential libglfw3-dev libgl1-mesa-dev

Windows


πŸš€ Build Instructions

1. Clone the Repository

git clone https://github.com/YOUR_USERNAME/project-csi.git
cd project-csi

2. Create Build Directory

mkdir build
cd build

3. Configure with CMake

cmake ..

4. Build the Project

cmake --build . --config Release -j$(nproc)

Or on Windows:

cmake --build . --config Release

▢️ Running the Application

Interactive GUI Mode

# From the build directory
./RaytracerUI

Command-Line Renderer

# Render with default settings
./Raytracer

# Render a specific scene
./Raytracer --scene cornell_water_scene.xml --bvh --samples 500

# Full options
./Raytracer --help

CLI Options

Flag Description
--scene <file> Scene XML file (default: objects.xml)
--out <file> Output image path
--width <W> Override image width
--samples <S> Samples per pixel
--bvh Use BVH acceleration (recommended)
--denoise Enable AI denoising (default)
--preset <name> Use preset: Preview, Draft, Final

πŸ“ Project Structure

project-csi/
β”œβ”€β”€ assets/                 # Scene files and 3D models
β”‚   β”œβ”€β”€ *.xml              # Scene definitions
β”‚   β”œβ”€β”€ *.obj              # 3D mesh files
β”‚   └── *.mtl              # Material files
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ engine/            # Core ray tracing engine
β”‚   β”‚   β”œβ”€β”€ camera.h/cpp   # Camera model
β”‚   β”‚   β”œβ”€β”€ material.h     # Material base class
β”‚   β”‚   β”œβ”€β”€ bvh_node.h/cpp # BVH acceleration
β”‚   β”‚   β”œβ”€β”€ render_runner.cpp # Tile-based renderer
β”‚   β”‚   └── ...
β”‚   β”œβ”€β”€ gui/               # ImGui application
β”‚   └── 3rdParty/          # External libraries
β”œβ”€β”€ renders/samples/       # Sample output images
β”œβ”€β”€ build/output/          # Rendered output directory
β”œβ”€β”€ CMakeLists.txt
└── README.md

πŸ–ΌοΈ Sample Outputs

Hundred Spheres with Sharp Shadowing and Lighting using BVH

Hundred Spheres with Sharp Shadowing and Lighting using BVH

Demonstrates refraction, caustics, and global illumination

GGX Material Test

GGX Materials

Showcases metallic roughness variations

100 Spheres

100 Spheres

BVH acceleration test with multiple objects

Random Scene

Random Scene

Scene with Chair Obj Rendering and Point Light Material


🎬 Demo Video

Interactive GUI Demo

test_video1.mp4

Real-time Rendering Demo

test_video3.mp4

Demonstration videos showing the interactive GUI and real-time rendering capabilities.


πŸ“– Key Concepts Implemented

The Rendering Equation

Lo(x,Ο‰o) = Le(x,Ο‰o) + ∫ f(x,Ο‰i,Ο‰o) Li(x,Ο‰i) cos(ΞΈi) dΟ‰i

BVH Acceleration

Reduces ray-scene intersection from O(n) to O(log n) using:

  • Axis-Aligned Bounding Boxes (AABB)
  • Surface Area Heuristic (SAH) for optimal tree construction

GGX Microfacet Model

Physically accurate BRDF with:

  • Normal Distribution Function (NDF)
  • Smith Geometry Function
  • Schlick Fresnel Approximation

πŸ‘₯ Authors

  • Abu Bakar

Supervisor: Professor Olivier Staadt
Institution: University of Rostock
Course: Project CSI - Visual and Analytical Computing (12 ECTS)


πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.


πŸ™ Acknowledgements

Releases

Packages

Contributors

Languages