A learning project following Peter Shirley's book series Ray Tracing in One Weekend (Version 4.0.2, 2025-04-25)
The goal for the first book is to create a C++ ray tracer which can create good-looking images
- A brute-force raytracer in C++23
- Outputs images in P3 PPM format
- Some command line arguments (will probably add more)
- Progress indicators while rendering
- Only supports spheres as shapes at the moment
- Many randomized properties to provide unique renders each time
- Multithreading support for significantly faster renders
Image properties:
- A C++23 (or later) compatible compiler (GCC, MSVC or Clang)
- CMake (version 3.1.0 or later recommended)
- Clone the repository
git clone https://github.com/JuJuz1/RayTracer.git
cd RayTracer- Build with CMake
cmake -B $(your_build_directory_name) # e.g. cmake -B build
cmake --build $(your_build_directory_name)
# for optimized builds
cmake --build $(your_build_directory_name) --config Release- Run the program
You can specify the number of threads to use, default is 1. The default output file is image.ppm
./$(your_build_directory_name)/Release/inOneWeekend [num_threads] [output_filename.ppm]There are many ways to view the created P3 PPM images. I found it easiest to use this website: PPM Viewer
This project includes a copy of cpplint.py. See License
To verify that the source files comply with most of the cpplint checks run:
./run_cpplint.shThis project uses the Catch2 framework for testing the application. See License. The test cases are built alongside the raytracer library. To run the tests it is very similar to running the application.
./$(your_build_directory_name)/Release/tests
