Gravitational Lensing Simulation Black Hole
A physics-informed simulation of a Schwarzschild black hole with real-time gravitational lensing

What it does
This real-time simulation traces light through curved spacetime using a custom GLSL raymarcher. It utilizes an approximated Kerr metric to simulate a rotating black hole, calculating a dynamic event horizon and spacetime frame-dragging based on the black hole's spin.
To calculate motion at 60 frames per second, the engine replaces heavy scientific integrators with a highly optimized, adaptive-step raymarching algorithm. This allows the system to take massive rendering steps in flat space and micro-steps near extreme gravity, preserving visual precision without sacrificing performance.
Visually, the camera employs backward ray tracing. A light ray is launched from every screen pixel, integrating through a volumetric accretion disk and bending around the photon sphere to lens distant, procedurally generated background stars.
The accretion disk is modeled as a thick, self-shadowing procedural gas cloud using the Beer-Lambert law for light absorption. For each pixel, the system calculates apparent blackbody temperature alongside relativistic beaming (Doppler shifting). The emitted light scales with the fourth power of the energy shift factor, creating a striking, physically grounded asymmetry between the intensely bright approaching side of the disk and the dim, red-shifted receding side. The final output is processed through industry-standard ACES filmic tonemapping to accurately render the blistering extremes of relativistic heat.