This is a small personal project where I explore ray tracing directly in a GLSL fragment shader. The C++ side is intentionally minimal: it just creates an OpenGL window, feeds camera/light data to the shader, and accumulates frames to help denoise.
- GLSL ray tracer with spheres, a ground plane, and basic materials
- Accumulation-based denoising when the camera is still
- ImGui controls for camera FOV, sun/sky lighting, and accumulation behavior
- First-person fly camera (mouse + WASD + Space/Shift)
- Cross platform (macOS, Linux, Windows)
- Simple CMake build
- CMake 3.28+
- C++17 compatible compiler
- OpenGL 4.1 core profile (macOS) or 3.3+ elsewhere
This repo uses submodules for GLFW and ImGui, so make sure you clone with
--recursive:
git clone https://github.com/ypatel2022/ray-tracer-glsl --recursivemkdir build
cd build
cmake ..
cmake --build .
./raytracermkdir build
cd build
cmake -G "MinGW Makefiles" ..
cmake --build .
./raytracer.exeW/A/S/DmoveSpace/Left Shiftup / down- Mouse look (capture with
Tab, release withTab) Escquit
