Port of @Lightning2X's and @Krien's old 2018 C# Raytracer in C++.
Code ported by @Krien, in a few days. So some functionality is missing such as camera movement or mirrors.
Code then optimized for the INFOMOV course by @Lightning2X and @PhoenixThrough. Leading up to a 31x performance improvement compared to the original. Optimization was done primarily through SIMD and multithreading. Using a lot of early outs in SIMD dramatically speeds up the code in multiple places. This code is still not fully optimal (what code ever is?) so if you see further improvement feel free to send me a message. Switching between the old and new code is possible through setting the SIMD definition to 0 or 1 in precomp.h.
See the table below for detailed results:
STAT | AVG | MIN | MAX |
---|---|---|---|
NEW | 116.50 | 81.30 | 141.24 |
OLD | 3.83 | 3.54 | 3.88 |
X FASTER | 31 | 23 | 36 |
This repo (currently) only contains the logic itself. This will NOT compile without adding libraries and setting a few settings. The instructions for this are described below
You first need to install SDL on your system from Here (add it in your Program Files and add to PATH).
You then need to grab 3 libraries:
You then need to place SDL's include, vector class and vec3d in Raytracer/deps/include:
Finally, place SDL's lib/x64 from the development library in Raytracer/deps/lib
Then include these folders in VS2022 by going to Raytracer -> Properties -> VC++ Directories. Now add all the 4 folders from ./include and ./dep and the program should run.