Path tracing rendering engine in poorly written C++20
# Release build
make release
./build/ronald --help
# Debug build
make debug
# Build and run unit tests
make test
Basic Feature Set
- CLI parsing
- PPM image generation
- Vec3 class implementation
- Ray/Sphere intersection calculation
- Ray/Triangle intersection
- Diffuse material scatter function
- Light source material
- Dielectric material
- Recursive tracing function
- Realistic camera model with aperture and field of view
- Single threaded render loop
- Clamp to [0, 1] tone mapping
- Scene description using JSON/JSONC config file
Extended Feature Set (Not considered MVP or required for final submission)
- Axis-aligned bounding box class
- Bounding Volume Hierarchy [1]
- Multithreaded render loop
- Reinhard Tone Mapping
- Reflective/semi-reflective material, including shallow-angle reflection and total internal reflection
- Russian Roulette path termination
[1] BVH is implemented but currently has poor (but still correct) performance when used in a multi-threaded context. I have not had the time to profile the app and determine the cause of the performance degradation, and since the BVH was outside of the project MVP from the beginning I am going to leave it as-is.
There was a long-standing error with Dielectric materials caused by setting T_MIN
too
low in the hit_objects
function. After hours of rummaging around in the code the bug
was located and fixed. Now the program can render nice looking glass materials.
Config | Value |
---|---|
Resolution | 512x512 |
Samples | 10000 |
Threads | 10 |
TMO | Reinhard Jodie |
Render Time | 18m57s |
Commit | a9d5e33f |
A description of Russian Roulette termination can be found in the /resources
folder.
I've also included comments in the relevant portion of code. The final image looks
identical, but notice that the render time has gone down from 33 minutes to just 20
minutes. This is a huge savings for just a few extra lines of code.
Config | Value |
---|---|
Resolution | 512x512 |
Samples | 10000 |
Threads | 10 |
TMO | Reinhard Jodie |
Render Time | 20m07s |
Commit | 153672b8 |
A longer description of the fix is included in the commit message. This commit marks the completion of the "MVP" portion of the project. I think at this point the project is probably in a "submittable" state and would receive a good grade.
Config | Value |
---|---|
Resolution | 512x512 |
Samples | 10000 |
Threads | 10 |
TMO | Reinhard Jodie |
Render Time | 33m40s |
Commit | 5c31f121 |
Added the full Cornell Box scene geometry based on the specification from their website. There is still a persisting bug where the renderer produces "vertical line" artifacts (look closely at the green wall). The boxes themselves also aren't completely perpendicular to the floor so there is some weird shading on the front of the taller box
Config | Value |
---|---|
Resolution | 512x512 |
Samples | 10000 |
Threads | 10 |
TMO | Reinhard Jodie |
Render Time | 51m36s |
Commit | 61cd6ee5 |
Config | Value |
---|---|
Resolution | 512x512 |
Samples | 7000 |
Threads | 10 |
TMO | Reinhard Jodie |
Render Time | 14m56s |
Commit | b9d00140 |
Config | Value |
---|---|
Resolution | 512x512 |
Samples | 7000 |
Threads | 1 |
TMO | Reinhard Jodie |
Render Time | 5h6m57s |
Commit | b6bbaab5 |