A Ray Tracer Renderer using C++. This project is aimed at helping me understand the fundamentals of Ray-tracing and how it works.
- Implementation of all features included in Ray Tracing In One Weekend
- Spheres
- Surface Normals
- Antialiasing
- Diffuse Materials
- Metal
- Dielectrics
- Positionable Camera
- Defocus Blur (“depth of field”)
- PNG image output
- Multi-Threading (with C++ STD and OpenMP)
- Render Time Information (ms)
This program has been tested on Pop OS and MacOS but should work under any system that has cmake and a C++ compiler installed. (Clion, Visual Studio)
Once project files are downloaded and you are currently in the project directory, you can generate the Makefile using the following command:
mkdir build
cd build/
cmake ..
Additionally in the CMakeLists.txt you can enabled different types of rendering, by default its single threaded.
Remove '#' to enable feature
#add_compile_definitions(MTHREAD)
#add_compile_definitions(MTHREAD_V2)
#add_compile_definitions(ENABLE_MP) <-- OpenMP Render
#add_compile_definitions(MTHREAD_TILE) <--- Tile MT Render
Now you can build the binary by running:
make
To generate the image, run the output binary in the terminal/cmd, which will result in the file appearing in the "images" folder
- Project Refactoring
- SDL Project conversion
- Runtime Rendering (being able to move the camera in a graphics window)
- Laurence Sadler - SirLorrence
- Tiny PNG Output - to write PNG file
- OpenMP
This code is released under the MIT License.
- Ray Tracing in One Weekend
- An Overview of the Ray-Tracing Rendering Technique
- 3D Math Primer for Graphics and Game Development. - Digitial and Physical
- ChatGPT - How to create a CMake file and cryptic compiler errors
- Adobe | What is a PPM file?