- Cuda Toolkit
- C++ compiler (g++ for linux, MSVC for Windows)
- GPU supported by CUDA
- CMake
CMake is used as build system.
mkdir build
cd build
cmake ..
make
mkdir build_debug
cd build_debug
cmake ..
make
Additional requirements:
A wrapper for building the source code on Windows can be found in tools/build.py
. This python script will invoke Ninja to build fast with MSVC and NVCC.
python3 ./tools/build.py R
python3 ./tools/build.py D
The executable can be found in the build directory.
Usage:
./raytracer input.scene output_directory width height nb_frames aliasing_level reflection_max_depth
- input.scene: the input file (must have the .scene format)
- output_directoy: the output directory in which the frames are stored (ppm format)
- width: width of the resolution of the output frame
- height: height of the resolution of the output frame
- nb_frames: number of frames to record
- aliasing level: level of aliasing by side. (i.e if aliasing level equals to 2, compute the mean of 2x2=4 pixels)
- reflection_max_depth: the maximum depth for the reflection
- Plan
- Sphere
- Raybox
- Triangle
According to the aliasing level (supposed n here), compute the mean color of nxn subpixels of the current pixel
The return of light. The reflection is restricted to the maximum reflection depth given as arguments.
The raytracer reads a specific file format .scene
.
A scene consists of a camera, a collection of lights and a collection of translatable and intersectable objects (geometric figures)
A scene file scenes/sample.scene
describes how to write a scene file for each geometric figures, camera and lights.
Several more samples can be found in scenes/*
:
scenes/frames
: scenes are static (thus it is not needed to render more than one frame)scenes/video
: scenes are static (thus it is not needed to render more than one frame)
tools/build.py
: wrapper to build on Windows. See usage above.tools/ppm_to_png.sh
: convert a ppm to a png (with the least compression). Usage:tools/ppn_to_png.sh input.ppm output.png
tools/ppm_to_video.sh
: convert a collection of ppm stored in aoutput
folder. Usage:tools/ppm_to_video.sh output.mp4