πͺ A simple raytracing library for generating photorealistic images written in C++.
It is developed for the course Numerical techniques for photorealistic image generation held by professor Maurizio Tomasi (University of Milan, AY2020-2021).
π©π»βπ» The main contributors to this repository are Elisa Legnani and Adele Zaini.
The main functionality of the library is rendering photorealistic images from user instructions on an external input text file. The code features four different backwards raytracing algorithms (onoff, flat, pathtracer, pointlight tracer) and βat the momentβ the scene elements are basic geometric shapes (spheres, planes, boxes). Setting material properties of the objects determines the interaction with light rays, while the observer point of view is represented by a camera with two different projections available (orthogonal and perspective). This library has another useful functionality that is converting HDR images to LDR ones. The format supported are respectively PFM and PNG/JPG.
π "Reality leaves a lot to the imagination." β J. Lennon. Here is the mean, now it's your turn... unleash all your imagination!
π A webpage Photorealistic rendering has been created in order to give more detailed explanations.
A C++ compiler is needed (C++14 or higher).
You also need to install the following dependencies:
If you want to parallelize the execution or run animations, the required dependencies are:
Note: they are not needed for running the raytracing code.
You can download the latest stable release here (version 1.1.0) and then unpack it running in the command line (Linux):
tar -xvf PhotorealisticRendering-1.0.0.tar
The command is tar xopf
for MacOS.
You can also clone this repository through the command:
git clone https://github.com/ElisaLegnani/PhotorealisticRendering.git
In order to build and compile the code, run the following commands:
cd PhotorealisticRendering
mkdir build
cd build
cmake ..
make
Executables files can be found in the build
directory.
Tests are being implemented in the test
directory.
In order to test the code, run in the build
directory:
ctest
The testing interface is built using Catch2.
You can run the program through the script raytracer
, located in the build
directory.
The code implements two features, that you can call with commands:
render
: creates a photorealistic image;hdr2ldr
: converts HDR image to LDR.The basic usage is the following:
./raytracer [COMMAND] [INPUT_FILENAME] {OPTIONS}
The [INPUT_FILENAME]
is required. There are some examples in the examples
directory if you want to give it a try or play with the code.
To have more information about available {OPTIONS}
, a commmand-line help shows more details about program features and parameters:
./raytracer --help
The command line interface is built using the argument parsing library Taywee/args.
π For further details, examples and full documentation of the code, see the page Photorealistic rendering.
π€Ήπ»ββοΈ There is a nice overview of the library potentialities with lots of examples, hoping this can tickle your creativity!
Here is just a spoiler of what awaits you!
π The complete documentation of the library is available here. It was generated with Doxygen. This is the first versione of the documentation, any suggestions are very appreciated!
π§ Please open pull requests or use the issue tracker to suggest any code implementations or report bugs. Any contributions are welcome!
π The code is released under the terms of the GNU General Public License v3.0. See the file LICENSE.md.