Skip to content

An OOP project for analytical ray tracing, written in C++.

Notifications You must be signed in to change notification settings

voaidesr/raytracing

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

41 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CPU-based Analytical Raytracer

This project is inspired by the Ray Tracing in One Weekend series, to which I have added some personal twists: unit tests using Catch2, a real-time visualiser using SFML and multithreading using OpenMP. I have also tried to write cleaner and more modular code.

Results

These are some cool images I was able to generate with my raytracer. These have rather high samples per pixel (500 or 700, depending on the image) to produce image of as high quality as possible.

After adding Beer-Lambert's law for absorbance in dielectric materials I got this:

Added Shlick's approximation for reflectance:

Added depth of field:

Note

This project is mostly educational, as it has been developed as a project for my OOP course in my first year of uni. One of my plans is to try to optimise it by parallelising the rendering on the GPU, possibly using CUDA C on NVIDIA GPUs.

Setup

Installing the prerequisites, on debian based Operating Systems:

sudo apt-get update && sudo apt-get install -y \
    cmake g++ libsfml-dev

Clone the repository:

git clone https://github.com/voaidesr/raytracing.git
cd raytracing

Then run, in order to compile:

mkdir build && cd build
cmake .. && make -j

To execute:

./raytracer > img.ppm

This will enable a live display of the image generation process and simultaneously store the image in img.ppm. After the image is generated, you can open the image with any image viewer that supports the .ppm format (e.g., feh).

To run tests:

ctest

About

An OOP project for analytical ray tracing, written in C++.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published