Schwarzschild Ray Tracer

A C++17 renderer that integrates null geodesics in the Schwarzschild metric to render a non-rotating black hole.

Source on GitHub

Render of a non-rotating black hole, a black disk ringed by a lensed blue starfield.

Overview

Each ray is integrated along a null geodesic, and its outcome maps to a pixel over a spherical background texture.

How it’s built

  • Tensor and 4D vector math utilities (math/core).
  • A separate relativity module for the Schwarzschild metric and geodesic equations (math/relativity).
  • Per-ray computation parallelized across all CPU threads with OpenMP, about 8x faster than without it.
  • CMake build with FetchContent.

Testing

  • Vector math and relativity modules unit-tested with GoogleTest.

Status

Done.