This is a training project aimed at learning ray tracing algorithm and practicing convert sequential CPU code into a parallelized GPU code using CUDA.
Ray tracing is a rendering technique for generating an image by tracing the path of light as pixels in an image plane and simulating the effects of its encounters with virtual objects. The technique is capable of producing a high degree of visual realism, more so than typical scanline rendering methods, but at a greater computational cost [1].
Happily, the rendering of images is a highly parallelizable activity, as color of every pixels can be calculated independently of the others.
Since graphics APIs such as OpenGL and DirectX are not designed for ray-traced rendering, implementing a GPU raytracer seems like a suitable project to practice with CUDA C++.
Application supports PLY and FBX file formats. The first may contain only polygon meshes, for the last one meshes, light sources and materials are supported.
OpenGL and freeglut libraries were used to display the resulting image.
The source code is published under BSD 2-clause, the license is available here.
git clone https://github.com/alexktvsky/raytracer.git
cd raytracer
mkdir build
cd build
cmake .. && cmake --build . --parallel
./raytracer ../assets/fbx/ak74m.fbx
- GNU/Linux
- macOS
- Windows 7 and above
- GLM (MIT License)
- freeglut (MIT License)
- CUDA Toolkit (NVIDIA Software License Agreement)
- hapPLY (MIT License)
- Mapbox Earcut (ISC License)
- Autodesk FBX SDK (Autodesk FBX SDK License)