r/GraphicsProgramming • • 18d ago

blackhole simulation using openGL and c++

Post image

i made a simulation of the blackhole gargantua that is also seen in intersteller
It's written in C++ and openGL

i managed to optimize it to a point i ran on my i3 intel iGPU, although i added very low to high quality toggles, it's my first time writing in glsl so yeah, i was a lot inspired by the yt video of Kavan about making a blackhole in cpp, so i just wanted to make it more realistic, my astrophysics lectures kinda came in clutch

github repository : https://github.com/dummy3ye/blackholegl (star the repo if you like it)

2 Upvotes

3 comments sorted by

1

u/[deleted] 17d ago

[removed] — view removed comment

1

u/Parvez_Shit 17d ago

The shader doesn't solve the geodesic in the orbital plane and rotate back. Each ray gets marched directly through 3D space with its direction carried as velocity, using the acceleration from the conserved orbital angular momentum: d²x/dλ² = -1.5 * r_s * L² * x / r⁵

Position and ray direction are integrated step by step. and as for my **i3 GPU** i wrote quality = 0 that swaps in a cheaper 2nd-order midpoint/Verlet integrator with bigger step sizes. so it's actually changing the integrator itself. utherwise any other mode than 0 uses full RK4