This repo real-time-renders lights near Schwarzschild black hole using CUDA and OpenGL in C++.
The derivation of geodesic equation in two dimensional space is in overleaf project.
In the folder demo, raytracing is demonstrated first in two-dimensional space. Then by simple coordination transformation, three-dimensional raytracing is also achieved. By numba acceleration, each frame needs about one minute.
Make sure Visual Studio is installed first then CUDA. Add C:\Program Files (x86)\Microsoft Visual Studio\18\BuildTools\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin to PATH. The CUDA related path are automatically added to PATH when installation.
Remove-Item -Recurse -Force build
then
cmake -B build
then
cmake --build build --config Release
The executable file is at build\Release\raytracer.exe.