I've always been fascinated by General Relativity, so I decided to see if I could simulate it myself. Rather than using visual effects software, I built a custom ray tracer from scratch that numerically integrates light paths around a Black Hole.

Details:

  • 4th order Runge Kutta (RK4) to solve for light deflection.
  • Accounts for the Einstein Ring, and relativistic lensing of the accretion disk.
  • GPU accelerated using CUDA, every pixel is a parallelized path through curved spacetime.
  • Using NASA Scientific Visualization Studio (SVS) data for the background stars.

🚀 Source Code (GPL v3): https://github.com/anwoy/MyCudaProject

🎥 Technical Breakdown: https://youtu.be/BUqQJPbZieQ



Share.

10 Comments

  1. Using AI voice and AI generated text lets me know that you vibe coded it, in other words you didn’t code shit.

  2. Pretty badass man. I need to do a little project like this because I too am a Software Engineer and love all things physics and space.

  3. silverbolt2000 on

    It would have been great to see what it would look like to fly past a black hole, but instead we just get 3 second snippets of flying near a black hole.

  4. May I ask what you used to generate the AI voice, I am just curious, as there are a lot of options available, but I thought if you implement a relativistic ray-tracer and have GPU(s) available, you likely went for a local text-to-speech model or one that outright narrated your video on a rough presentation outline?

  5. Shouldn’t the rotation of the black hole cause one side to be significantly brighter than the other side due to doppler beaming?

  6. Excellent work!

    Ignore the haters, they clearly don’t have enough comprehension to understand what you’ve done.

    Are you a student?

  7. That is one of the neatest and most informative videos I’ve ever seen about general relativity on Youtube. I was wondering if you could place your viewpoint inside the event horizon. I realize that would not be able to trace rays to points outside the event horizon, but you could trace trial rays from outside the event horizon and see where they ended up inside to figure out the map between points outside the horizon and rays ending at a particular viewpoint. I am not sure if the singularity of the Schwarzchild solution would allow for the geodesic equation to be continued past the event horizon, or if a different solution which is continuous at the event horizon would be needed.