Interactive Path Tracing Renderer with an OpenGL backend, written in C.
- GUI to control internal rendering parameters
- Support for many GPUs (specifically those without hardware ray tracing support) thanks to the usage of OpenGL 4.6
- Basic support of glTF 2.0
- Move the camera around the scene
- Save rendered image to file
- Two BVH types are available: Midpoint split and a Surface Area Heuristic
- Settings available from CLI
NOTE: Prebuilt binaries for Windows, macOS and Linux can be downloaded from the Releases page.
This project uses submodules for its dependencies, so make sure to get them when cloning.
git clone https://github.com/MaksRawski/PathTracingRenderer --recurse-submodules
If you have cloned without submodules, run this inside the project directory
git submodule update --init --recursive
The only system dependencies on Linux are make, cmake a C compiler and whatever
GLFW needs.
On Windows and macOS, cmake and a C compiler should be enough.
Once you have them, you can build the project using either Make (recommended for Linux) or CMake (only option for Windows and macOS).
Build dependencies
make -Clib
Build the project
make MODE=release
Run it
./build/release/main
Run tests:
make tests
Configure
cmake -Bbuild -DCMAKE_BUILD_TYPE=Release
Build the project
cmake --build build --config Release
Run it
./build/Release/PathTracingRenderer.exe
Run tests:
cmake -Bbuild -DBUILD_TESTS=ON && cmake --build build --config Debug && ./build/debug/tests.exe
Configure
cmake -Bbuild -DCMAKE_BUILD_TYPE=Release
Build the project
cmake --build build
Run it
./build/PathTracingRenderer
Run tests:
cmake -Bbuild -DBUILD_TESTS=ON && cmake --build build && ./build/tests
-
snake_casefor function_names, variable_names and struct_members -
PascalCasefor StructNames -
MACRO_CASEfor macros -
StructName_newfor "constructors" andStructName_deletefor "destructors" -
StructName_function_namefor functions that operate on a given struct directly -
function__templatefor macros that expand into function definitions -
a pair of
MACRO_NAMEandMACRO_NAME_implfor functions that need__LINE__and__FILE__ -
MACRO_NAME_for a not to be used directly macro -
g_GLOBALfor global variables
- "private" struct functions/helper functions are
staticdefined within the same translation unit. - stack allocation is heavily preferred
- functions that "return a string" take a
char *bufas argument or return eitherSmallString(char[1024]) orTinyString(char[16]) - 16MB Arena is allocated at the beginning of main and is passed around for all temporary allocations needs
- only big allocations (theoretically gigabytes) are
malloc'ed stdint.htypes are preferred overint,longetc.
